!function(t){"function"==typeof define&&define.amd?define(["jquery","./core","./mouse","./widget"],t):t(jQuery)}(function(u){return u.widget("ui.sortable",u.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return e<=t&&t*{ cursor: "+r.cursor+" !important; }").appendTo(o)),r.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",r.opacity)),r.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",r.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(s=this.containers.length-1;0<=s;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return u.ui.ddmanager&&(u.ui.ddmanager.current=this),u.ui.ddmanager&&!r.dropBehaviour&&u.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var e,i,s,o,r=this.options,n=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageYt[this.floating?"width":"height"]?u:r",i.document[0]).addClass(s||i.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===t?i._createTrPlaceholder(i.currentItem.find("tr").eq(0),u("",i.document[0]).appendTo(e)):"tr"===t?i._createTrPlaceholder(i.currentItem,e):"img"===t&&e.attr("src",i.currentItem.attr("src")),s||e.css("visibility","hidden"),e},update:function(t,e){s&&!o.forcePlaceholderSize||(e.height()||e.height(i.currentItem.innerHeight()-parseInt(i.currentItem.css("paddingTop")||0,10)-parseInt(i.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(i.currentItem.innerWidth()-parseInt(i.currentItem.css("paddingLeft")||0,10)-parseInt(i.currentItem.css("paddingRight")||0,10)))}}),i.placeholder=u(o.placeholder.element.call(i.element,i.currentItem)),i.currentItem.after(i.placeholder),o.placeholder.update(i,i.placeholder)},_createTrPlaceholder:function(t,e){var i=this;t.children().each(function(){u(" ",i.document[0]).attr("colspan",u(this).attr("colspan")||1).appendTo(e)})},_contactContainers:function(t){var e,i,s,o,r,n,h,a,l,c,p=null,f=null;for(e=this.containers.length-1;0<=e;e--)if(!u.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(p&&u.contains(this.containers[e].element[0],p.element[0]))continue;p=this.containers[e],f=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",t,this._uiHash(this)),this.containers[e].containerCache.over=0);if(p)if(1===this.containers.length)this.containers[f].containerCache.over||(this.containers[f]._trigger("over",t,this._uiHash(this)),this.containers[f].containerCache.over=1);else{for(s=1e4,o=null,r=(l=p.floating||this._isFloating(this.currentItem))?"left":"top",n=l?"width":"height",c=l?"clientX":"clientY",i=this.items.length-1;0<=i;i--)u.contains(this.containers[f].element[0],this.items[i].item[0])&&this.items[i].item[0]!==this.currentItem[0]&&(h=this.items[i].item.offset()[r],a=!1,t[c]-h>this.items[i][n]/2&&(a=!0),Math.abs(t[c]-h)this.containment[2]&&(o=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(r=this.containment[3]+this.offset.click.top)),s.grid&&(e=this.originalPageY+Math.round((r-this.originalPageY)/s.grid[1])*s.grid[1],r=this.containment?e-this.offset.click.top>=this.containment[1]&&e-this.offset.click.top<=this.containment[3]?e:e-this.offset.click.top>=this.containment[1]?e-s.grid[1]:e+s.grid[1]:e,i=this.originalPageX+Math.round((o-this.originalPageX)/s.grid[0])*s.grid[0],o=this.containment?i-this.offset.click.left>=this.containment[0]&&i-this.offset.click.left<=this.containment[2]?i:i-this.offset.click.left>=this.containment[0]?i-s.grid[0]:i+s.grid[0]:i)),{top:r-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:n.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:n.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var o=this.counter;this._delay(function(){o===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)"auto"!==this._storedCSS[i]&&"static"!==this._storedCSS[i]||(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();function o(e,i,s){return function(t){s._trigger(e,t,i._uiHash(i))}}for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;0<=i;i--)e||s.push(o("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(o("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i"))}function a(e){var t="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(t,"mouseout",function(){b(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&b(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&b(this).removeClass("ui-datepicker-next-hover")}).delegate(t,"mouseover",n)}function n(){b.datepicker._isDisabledDatepicker(r.inline?r.dpDiv.parent()[0]:r.input[0])||(b(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),b(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&b(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&b(this).addClass("ui-datepicker-next-hover"))}function h(e,t){for(var a in b.extend(e,t),t)null==t[a]&&(e[a]=t[a]);return e}return b.extend(b.ui,{datepicker:{version:"1.11.4"}}),b.extend(e.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return h(this._defaults,e||{}),this},_attachDatepicker:function(e,t){var a,i,s;i="div"===(a=e.nodeName.toLowerCase())||"span"===a,e.id||(this.uuid+=1,e.id="dp"+this.uuid),(s=this._newInst(b(e),i)).settings=b.extend({},t||{}),"input"===a?this._connectDatepicker(e,s):i&&this._inlineDatepicker(e,s)},_newInst:function(e,t){return{id:e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:t,dpDiv:t?a(b("
")):this.dpDiv}},_connectDatepicker:function(e,t){var a=b(e);t.append=b([]),t.trigger=b([]),a.hasClass(this.markerClassName)||(this._attachments(a,t),a.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(t),b.data(e,"datepicker",t),t.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,t){var a,i,s,r=this._get(t,"appendText"),n=this._get(t,"isRTL");t.append&&t.append.remove(),r&&(t.append=b(""+r+""),e[n?"before":"after"](t.append)),e.unbind("focus",this._showDatepicker),t.trigger&&t.trigger.remove(),"focus"!==(a=this._get(t,"showOn"))&&"both"!==a||e.focus(this._showDatepicker),"button"!==a&&"both"!==a||(i=this._get(t,"buttonText"),s=this._get(t,"buttonImage"),t.trigger=b(this._get(t,"buttonImageOnly")?b("").addClass(this._triggerClass).attr({src:s,alt:i,title:i}):b("").addClass(this._triggerClass).html(s?b("").attr({src:s,alt:i,title:i}):i)),e[n?"before":"after"](t.trigger),t.trigger.click(function(){return b.datepicker._datepickerShowing&&b.datepicker._lastInput===e[0]?b.datepicker._hideDatepicker():(b.datepicker._datepickerShowing&&b.datepicker._lastInput!==e[0]&&b.datepicker._hideDatepicker(),b.datepicker._showDatepicker(e[0])),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,a,i,s,r=new Date(2009,11,20),n=this._get(e,"dateFormat");n.match(/[DM]/)&&(t=function(e){for(s=i=a=0;sa&&(a=e[s].length,i=s);return i},r.setMonth(t(this._get(e,n.match(/MM/)?"monthNames":"monthNamesShort"))),r.setDate(t(this._get(e,n.match(/DD/)?"dayNames":"dayNamesShort"))+20-r.getDay())),e.input.attr("size",this._formatDate(e,r).length)}},_inlineDatepicker:function(e,t){var a=b(e);a.hasClass(this.markerClassName)||(a.addClass(this.markerClassName).append(t.dpDiv),b.data(e,"datepicker",t),this._setDate(t,this._getDefaultDate(t),!0),this._updateDatepicker(t),this._updateAlternate(t),t.settings.disabled&&this._disableDatepicker(e),t.dpDiv.css("display","block"))},_dialogDatepicker:function(e,t,a,i,s){var r,n,d,c,o,l=this._dialogInst;return l||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=b(""),this._dialogInput.keydown(this._doKeyDown),b("body").append(this._dialogInput),(l=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},b.data(this._dialogInput[0],"datepicker",l)),h(l.settings,i||{}),t=t&&t.constructor===Date?this._formatDate(l,t):t,this._dialogInput.val(t),this._pos=s?s.length?s:[s.pageX,s.pageY]:null,this._pos||(n=document.documentElement.clientWidth,d=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,o=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[n/2-100+c,d/2-150+o]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),l.settings.onSelect=a,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),b.blockUI&&b.blockUI(this.dpDiv),b.data(this._dialogInput[0],"datepicker",l),this},_destroyDatepicker:function(e){var t,a=b(e),i=b.data(e,"datepicker");a.hasClass(this.markerClassName)&&(t=e.nodeName.toLowerCase(),b.removeData(e,"datepicker"),"input"===t?(i.append.remove(),i.trigger.remove(),a.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):"div"!==t&&"span"!==t||a.removeClass(this.markerClassName).empty(),r===i&&(r=null))},_enableDatepicker:function(t){var e,a,i=b(t),s=b.data(t,"datepicker");i.hasClass(this.markerClassName)&&("input"===(e=t.nodeName.toLowerCase())?(t.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!==e&&"span"!==e||((a=i.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=b.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var e,a,i=b(t),s=b.data(t,"datepicker");i.hasClass(this.markerClassName)&&("input"===(e=t.nodeName.toLowerCase())?(t.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!==e&&"span"!==e||((a=i.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),a.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=b.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;td&&ic&&st;)--G<0&&(G=11,ee--);for(e.drawMonth=G,e.drawYear=ee,a=this._get(e,"prevText"),a=B?this.formatDate(a,this._daylightSavingAdjust(new Date(ee,G-q,1)),this._getFormatConfig(e)):a,i=this._canAdjustMonth(e,-1,ee,G)?""+a+"":z?"":""+a+"",s=this._get(e,"nextText"),s=B?this.formatDate(s,this._daylightSavingAdjust(new Date(ee,G+q,1)),this._getFormatConfig(e)):s,r=this._canAdjustMonth(e,1,ee,G)?""+s+"":z?"":""+s+"",n=this._get(e,"currentText"),d=this._get(e,"gotoCurrent")&&e.currentDay?X:H,n=B?this.formatDate(n,d,this._getFormatConfig(e)):n,c=e.inline?"":"",o=U?"
"+(P?c:"")+(this._isInRange(e,d)?"":"")+(P?"":c)+"
":"",l=parseInt(this._get(e,"firstDay"),10),l=isNaN(l)?0:l,h=this._get(e,"showWeek"),u=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),g=this._get(e,"monthNames"),_=this._get(e,"monthNamesShort"),f=this._get(e,"beforeShowDay"),k=this._get(e,"showOtherMonths"),D=this._get(e,"selectOtherMonths"),m=this._getDefaultDate(e),y="",M=0;M"+(/all|left/.test(I)&&0===M?P?r:i:"")+(/all|right/.test(I)&&0===M?P?i:r:"")+this._generateMonthYearHeader(e,G,ee,Z,$,0",Y=h?"":"",v=0;v<7;v++)Y+="";for(x+=Y+"",N=this._getDaysInMonth(ee,G),ee===e.selectedYear&&G===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,N)),F=(this._getFirstDayOfMonth(ee,G)-l+7)%7,T=Math.ceil((F+N)/7),A=Q&&this.maxRows>T?this.maxRows:T,this.maxRows=A,K=this._daylightSavingAdjust(new Date(ee,G,1-F)),j=0;j",O=h?"":"",v=0;v<7;v++)R=f?f.apply(e.input?e.input[0]:null,[K]):[!0,""],W=(L=K.getMonth()!==G)&&!D||!R[0]||Z&&K"+(L&&!k?" ":W?""+K.getDate()+"":""+K.getDate()+"")+"",K.setDate(K.getDate()+1),K=this._daylightSavingAdjust(K);x+=O+""}11<++G&&(G=0,ee++),b+=x+="
"+this._get(e,"weekHeader")+""+p[S]+"
"+this._get(e,"calculateWeek")(K)+"
"+(Q?""+(0":""):"")}y+=b}return y+=o,e._keyEvent=!1,y},_generateMonthYearHeader:function(e,t,a,i,s,r,n,d){var c,o,l,h,u,p,g,_,f=this._get(e,"changeMonth"),k=this._get(e,"changeYear"),D=this._get(e,"showMonthAfterYear"),m="
",y="";if(r||!f)y+=""+n[t]+"";else{for(c=i&&i.getFullYear()===a,o=s&&s.getFullYear()===a,y+=""}if(D||(m+=y+(!r&&f&&k?"":" ")),!e.yearshtml)if(e.yearshtml="",r||!k)m+=""+a+"";else{for(h=this._get(e,"yearRange").split(":"),u=(new Date).getFullYear(),g=(p=function(e){var t=e.match(/c[+\-].*/)?a+parseInt(e.substring(1),10):e.match(/[+\-].*/)?u+parseInt(e,10):parseInt(e,10);return isNaN(t)?u:t})(h[0]),_=Math.max(g,p(h[1]||"")),g=i?Math.max(g,i.getFullYear()):g,_=s?Math.min(_,s.getFullYear()):_,e.yearshtml+="",m+=e.yearshtml,e.yearshtml=null}return m+=this._get(e,"yearSuffix"),D&&(m+=(!r&&f&&k?"":" ")+y),m+="
"},_adjustInstDate:function(e,t,a){var i=e.drawYear+("Y"===a?t:0),s=e.drawMonth+("M"===a?t:0),r=Math.min(e.selectedDay,this._getDaysInMonth(i,s))+("D"===a?t:0),n=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(i,s,r)));e.selectedDay=n.getDate(),e.drawMonth=e.selectedMonth=n.getMonth(),e.drawYear=e.selectedYear=n.getFullYear(),"M"!==a&&"Y"!==a||this._notifyChange(e)},_restrictMinMax:function(e,t){var a=this._getMinMaxDate(e,"min"),i=this._getMinMaxDate(e,"max"),s=a&&t=s.getTime())&&(!r||t.getTime()<=r.getTime())&&(!n||t.getFullYear()>=n)&&(!d||t.getFullYear()<=d)},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return{shortYearCutoff:t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,a,i){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var s=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(i,a,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),s,this._getFormatConfig(e))}}),b.fn.datepicker=function(e){if(!this.length)return this;b.datepicker.initialized||(b(document).mousedown(b.datepicker._checkExternalClick),b.datepicker.initialized=!0),0===b("#"+b.datepicker._mainDivId).length&&b("body").append(b.datepicker.dpDiv);var t=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?b.datepicker["_"+e+"Datepicker"].apply(b.datepicker,[this[0]].concat(t)):this.each(function(){"string"==typeof e?b.datepicker["_"+e+"Datepicker"].apply(b.datepicker,[this].concat(t)):b.datepicker._attachDatepicker(this,e)}):b.datepicker["_"+e+"Datepicker"].apply(b.datepicker,[this[0]].concat(t))},b.datepicker=new e,b.datepicker.initialized=!1,b.datepicker.uuid=(new Date).getTime(),b.datepicker.version="1.11.4",b.datepicker}); +function ($){ "use strict"; var Tooltip=function (element, options){ this.type = this.options = this.enabled = this.timeout = this.hoverState = this.$element=null this.init('tooltip', element, options) } Tooltip.DEFAULTS={ animation: true , placement: 'top' , selector: false , template: '
' , trigger: 'hover focus' , title: '' , delay: 0 , html: false , container: false } Tooltip.prototype.init=function (type, element, options){ this.enabled=true this.type=type this.$element=$(element) this.options=this.getOptions(options) var triggers=this.options.trigger.split(' ') for (var i=triggers.length; i--;){ var trigger=triggers[i] if(trigger=='click'){ this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) }else if(trigger!='manual'){ var eventIn=trigger=='hover' ? 'mouseenter':'focus' var eventOut=trigger=='hover' ? 'mouseleave':'blur' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) }} this.options.selector ? (this._options=$.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() } Tooltip.prototype.getDefaults=function (){ return Tooltip.DEFAULTS } Tooltip.prototype.getOptions=function (options){ options=$.extend({}, this.getDefaults(), this.$element.data(), options) if(options.delay&&typeof options.delay=='number'){ options.delay={ show: options.delay , hide: options.delay }} return options } Tooltip.prototype.getDelegateOptions=function (){ var options={} var defaults=this.getDefaults() this._options&&$.each(this._options, function (key, value){ if(defaults[key]!=value) options[key]=value }) return options } Tooltip.prototype.enter=function (obj){ var self=obj instanceof this.constructor ? obj:$(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) clearTimeout(self.timeout) self.hoverState='in' if(!self.options.delay||!self.options.delay.show) return self.show() self.timeout=setTimeout(function (){ if(self.hoverState=='in') self.show() }, self.options.delay.show) } Tooltip.prototype.leave=function (obj){ var self=obj instanceof this.constructor ? obj:$(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) clearTimeout(self.timeout) self.hoverState='out' if(!self.options.delay||!self.options.delay.hide) return self.hide() self.timeout=setTimeout(function (){ if(self.hoverState=='out') self.hide() }, self.options.delay.hide) } Tooltip.prototype.show=function (){ var e=$.Event('show.bs.'+ this.type) if(this.hasContent()&&this.enabled){ this.$element.trigger(e) if(e.isDefaultPrevented()) return var $tip=this.tip() this.setContent() if(this.options.animation) $tip.addClass('fade') var placement=typeof this.options.placement=='function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement var autoToken=/\s?auto?\s?/i var autoPlace=autoToken.test(placement) if(autoPlace) placement=placement.replace(autoToken, '')||'top' $tip .detach() .css({ top: 0, left: 0, display: 'block' }) .addClass(placement) this.options.container ? $tip.appendTo(this.options.container):$tip.insertAfter(this.$element) var pos=this.getPosition() var actualWidth=$tip[0].offsetWidth var actualHeight=$tip[0].offsetHeight if(autoPlace){ var $parent=this.$element.parent() var orgPlacement=placement var docScroll=document.documentElement.scrollTop||document.body.scrollTop var parentWidth=this.options.container=='body' ? window.innerWidth:$parent.outerWidth() var parentHeight=this.options.container=='body' ? window.innerHeight:$parent.outerHeight() var parentLeft=this.options.container=='body' ? 0:$parent.offset().left placement=placement=='bottom'&&pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' : placement=='top'&&pos.top - docScroll - actualHeight < 0 ? 'bottom' : placement=='right'&&pos.right + actualWidth > parentWidth ? 'left' : placement=='left'&&pos.left - actualWidth < parentLeft ? 'right' : placement $tip .removeClass(orgPlacement) .addClass(placement) } var calculatedOffset=this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) this.applyPlacement(calculatedOffset, placement) this.$element.trigger('shown.bs.' + this.type) }} Tooltip.prototype.applyPlacement=function(offset, placement){ var replace var $tip=this.tip() var width=$tip[0].offsetWidth var height=$tip[0].offsetHeight var marginTop=parseInt($tip.css('margin-top'), 10) var marginLeft=parseInt($tip.css('margin-left'), 10) if(isNaN(marginTop)) marginTop=0 if(isNaN(marginLeft)) marginLeft=0 offset.top=offset.top + marginTop offset.left=offset.left + marginLeft $tip .offset(offset) .addClass('in') var actualWidth=$tip[0].offsetWidth var actualHeight=$tip[0].offsetHeight if(placement=='top'&&actualHeight!=height){ replace=true offset.top=offset.top + height - actualHeight } if(/bottom|top/.test(placement)){ var delta=0 if(offset.left < 0){ delta=offset.left * -2 offset.left=0 $tip.offset(offset) actualWidth=$tip[0].offsetWidth actualHeight=$tip[0].offsetHeight } this.replaceArrow(delta - width + actualWidth, actualWidth, 'left') }else{ this.replaceArrow(actualHeight - height, actualHeight, 'top') } if(replace) $tip.offset(offset) } Tooltip.prototype.replaceArrow=function(delta, dimension, position){ this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%"):'') } Tooltip.prototype.setContent=function (){ var $tip=this.tip() var title=this.getTitle() $tip.find('.tooltip-inner')[this.options.html ? 'html':'text'](title) $tip.removeClass('fade in top bottom left right') } Tooltip.prototype.hide=function (){ var that=this var $tip=this.tip() var e=$.Event('hide.bs.' + this.type) function complete(){ if(that.hoverState!='in') $tip.detach() } this.$element.trigger(e) if(e.isDefaultPrevented()) return $tip.removeClass('in') $.support.transition&&this.$tip.hasClass('fade') ? $tip .one($.support.transition.end, complete) .emulateTransitionEnd(150) : complete() this.$element.trigger('hidden.bs.' + this.type) return this } Tooltip.prototype.fixTitle=function (){ var $e=this.$element if($e.attr('title')||typeof($e.attr('data-original-title'))!='string'){ $e.attr('data-original-title', $e.attr('title')||'').attr('title', '') }} Tooltip.prototype.hasContent=function (){ return this.getTitle() } Tooltip.prototype.getPosition=function (){ var el=this.$element[0] return $.extend({}, (typeof el.getBoundingClientRect=='function') ? el.getBoundingClientRect():{ width: el.offsetWidth , height: el.offsetHeight }, this.$element.offset()) } Tooltip.prototype.getCalculatedOffset=function (placement, pos, actualWidth, actualHeight){ return placement=='bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement=='top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement=='left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }} Tooltip.prototype.getTitle=function (){ var title var $e=this.$element var o=this.options title=$e.attr('data-original-title') || (typeof o.title=='function' ? o.title.call($e[0]):o.title) return title } Tooltip.prototype.tip=function (){ return this.$tip=this.$tip||$(this.options.template) } Tooltip.prototype.arrow=function (){ return this.$arrow=this.$arrow||this.tip().find('.tooltip-arrow') } Tooltip.prototype.validate=function (){ if(!this.$element[0].parentNode){ this.hide() this.$element=null this.options=null }} Tooltip.prototype.enable=function (){ this.enabled=true } Tooltip.prototype.disable=function (){ this.enabled=false } Tooltip.prototype.toggleEnabled=function (){ this.enabled = !this.enabled } Tooltip.prototype.toggle=function (e){ var self=e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type):this self.tip().hasClass('in') ? self.leave(self):self.enter(self) } Tooltip.prototype.destroy=function (){ this.hide().$element.off('.' + this.type).removeData('bs.' + this.type) } var old=$.fn.tooltip $.fn.tooltip=function (option){ return this.each(function (){ var $this=$(this) var data=$this.data('bs.tooltip') var options=typeof option=='object'&&option if(!data) $this.data('bs.tooltip', (data=new Tooltip(this, options))) if(typeof option=='string') data[option]() }) } $.fn.tooltip.Constructor=Tooltip $.fn.tooltip.noConflict=function (){ $.fn.tooltip=old return this } $.fn.emulateTransitionEnd=function (duration){ var called=false, $el=this $(this).one($.support.transition.end, function (){ called=true }) var callback=function (){ if(!called) $($el).trigger($.support.transition.end) } setTimeout(callback, duration) return this }}(window.jQuery); +function ($){ "use strict"; var dismiss='[data-dismiss="alert"]' var Alert=function (el){ $(el).on('click', dismiss, this.close) } Alert.prototype.close=function (e){ var $this=$(this) var selector=$this.attr('data-target') if(!selector){ selector=$this.attr('href') selector=selector&&selector.replace(/.*(?=#[^\s]*$)/, '') } var $parent=$(selector) if(e) e.preventDefault() if(!$parent.length){ $parent=$this.hasClass('dokan-alert') ? $this:$this.parent() } $parent.trigger(e=$.Event('dokan-close.bs.alert')) if(e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement(){ $parent.trigger('dokan-closed.bs.alert').remove() } $.support.transition&&$parent.hasClass('fade') ? $parent .one($.support.transition.end, removeElement) .emulateTransitionEnd(150) : removeElement() } var old=$.fn.alert $.fn.alert=function (option){ return this.each(function (){ var $this=$(this) var data=$this.data('bs.alert') if(!data) $this.data('bs.alert', (data=new Alert(this))) if(typeof option=='string') data[option].call($this) }) } $.fn.alert.Constructor=Alert $.fn.alert.noConflict=function (){ $.fn.alert=old return this } $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) }(window.jQuery); (function($){ $.extend($.fn, { validate: function(options){ if(!this.length){ if(options&&options.debug&&window.console){ console.warn("Nothing selected, can't validate, returning nothing."); } return; } var validator=$.data(this[0], "validator"); if(validator){ return validator; } this.attr("novalidate", "novalidate"); validator=new $.validator(options, this[0]); $.data(this[0], "validator", validator); if(validator.settings.onsubmit){ this.validateDelegate(":submit", "click", function(event){ if(validator.settings.submitHandler){ validator.submitButton=event.target; } if($(event.target).hasClass("cancel")){ validator.cancelSubmit=true; }}); this.submit(function(event){ if(validator.settings.debug){ event.preventDefault(); } function handle(){ var hidden; if(validator.settings.submitHandler){ if(validator.submitButton){ hidden=$("").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); } validator.settings.submitHandler.call(validator, validator.currentForm, event); if(validator.submitButton){ hidden.remove(); } return false; } return true; } if(validator.cancelSubmit){ validator.cancelSubmit=false; return handle(); } if(validator.form()){ if(validator.pendingRequest){ validator.formSubmitted=true; return false; } return handle(); }else{ validator.focusInvalid(); return false; }}); } return validator; }, valid: function(){ if($(this[0]).is("form")){ return this.validate().form(); }else{ var valid=true; var validator=$(this[0].form).validate(); this.each(function(){ valid &=validator.element(this); }); return valid; }}, removeAttrs: function(attributes){ var result={}, $element=this; $.each(attributes.split(/\s/), function(index, value){ result[value]=$element.attr(value); $element.removeAttr(value); }); return result; }, rules: function(command, argument){ var element=this[0]; if(command){ var settings=$.data(element.form, "validator").settings; var staticRules=settings.rules; var existingRules=$.validator.staticRules(element); switch(command){ case "add": $.extend(existingRules, $.validator.normalizeRule(argument)); staticRules[element.name]=existingRules; if(argument.messages){ settings.messages[element.name]=$.extend(settings.messages[element.name], argument.messages); } break; case "remove": if(!argument){ delete staticRules[element.name]; return existingRules; } var filtered={}; $.each(argument.split(/\s/), function(index, method){ filtered[method]=existingRules[method]; delete existingRules[method]; }); return filtered; }} var data=$.validator.normalizeRules($.extend({}, $.validator.classRules(element), $.validator.attributeRules(element), $.validator.dataRules(element), $.validator.staticRules(element) ), element); if(data.required){ var param=data.required; delete data.required; data=$.extend({required: param}, data); } return data; }}); $.extend($.expr[":"], { blank: function(a){ return !$.trim("" + a.value); }, filled: function(a){ return !!$.trim("" + a.value); }, unchecked: function(a){ return !a.checked; }}); $.validator=function(options, form){ this.settings=$.extend(true, {}, $.validator.defaults, options); this.currentForm=form; this.init(); }; $.validator.format=function(source, params){ if(arguments.length===1){ return function(){ var args=$.makeArray(arguments); args.unshift(source); return $.validator.format.apply(this, args); };} if(arguments.length > 2&¶ms.constructor!==Array){ params=$.makeArray(arguments).slice(1); } if(params.constructor!==Array){ params=[ params ]; } $.each(params, function(i, n){ source=source.replace(new RegExp("\\{" + i + "\\}", "g"), function(){ return n; }); }); return source; }; $.extend($.validator, { defaults: { messages: {}, groups: {}, rules: {}, errorClass: "error", validClass: "valid", errorElement: "label", focusInvalid: true, errorContainer: $([]), errorLabelContainer: $([]), onsubmit: true, ignore: ":hidden", ignoreTitle: false, onfocusin: function(element, event){ this.lastActive=element; if(this.settings.focusCleanup&&!this.blockFocusCleanup){ if(this.settings.unhighlight){ this.settings.unhighlight.call(this, element, this.settings.errorClass, this.settings.validClass); } this.addWrapper(this.errorsFor(element)).hide(); }}, onfocusout: function(element, event){ if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){ this.element(element); }}, /* onkeyup: function(element, event){ if(event.which===9&&this.elementValue(element)===""){ return; }else if(element.name in this.submitted||element===this.lastElement){ this.element(element); }}, */ onclick: function(element, event){ if(element.name in this.submitted){ this.element(element); } else if(element.parentNode.name in this.submitted){ this.element(element.parentNode); }}, highlight: function(element, errorClass, validClass){ if(element.type==="radio"){ this.findByName(element.name).addClass(errorClass).removeClass(validClass); }else{ $(element).addClass(errorClass).removeClass(validClass); }}, unhighlight: function(element, errorClass, validClass){ if(element.type==="radio"){ this.findByName(element.name).removeClass(errorClass).addClass(validClass); }else{ $(element).removeClass(errorClass).addClass(validClass); }} }, setDefaults: function(settings){ $.extend($.validator.defaults, settings); }, messages: { required: "This field is required.", remote: "Please fix this field.", email: "Please enter a valid email address.", url: "Please enter a valid URL.", date: "Please enter a valid date.", dateISO: "Please enter a valid date (ISO).", number: "Please enter a valid number.", digits: "Please enter only digits.", creditcard: "Please enter a valid credit card number.", equalTo: "Please enter the same value again.", maxlength: $.validator.format("Please enter no more than {0} characters."), minlength: $.validator.format("Please enter at least {0} characters."), rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), range: $.validator.format("Please enter a value between {0} and {1}."), max: $.validator.format("Please enter a value less than or equal to {0}."), min: $.validator.format("Please enter a value greater than or equal to {0}.") }, autoCreateRanges: false, prototype: { init: function(){ this.labelContainer=$(this.settings.errorLabelContainer); this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm); this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer); this.submitted={}; this.valueCache={}; this.pendingRequest=0; this.pending={}; this.invalid={}; this.reset(); var groups=(this.groups={}); $.each(this.settings.groups, function(key, value){ if(typeof value==="string"){ value=value.split(/\s/); } $.each(value, function(index, name){ groups[name]=key; }); }); var rules=this.settings.rules; $.each(rules, function(key, value){ rules[key]=$.validator.normalizeRule(value); }); function delegate(event){ var validator=$.data(this[0].form, "validator"), eventType="on" + event.type.replace(/^validate/, ""); if(validator.settings[eventType]){ validator.settings[eventType].call(validator, this[0], event); }} $(this.currentForm) .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + "[type='email'], [type='datetime'], [type='date'], [type='month'], " + "[type='week'], [type='time'], [type='datetime-local'], " + "[type='range'], [type='color'] ", "focusin focusout keyup", delegate) .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate); if(this.settings.invalidHandler){ $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); }}, form: function(){ this.checkForm(); $.extend(this.submitted, this.errorMap); this.invalid=$.extend({}, this.errorMap); if(!this.valid()){ $(this.currentForm).triggerHandler("invalid-form", [this]); } this.showErrors(); return this.valid(); }, checkForm: function(){ this.prepareForm(); for(var i=0, elements=(this.currentElements=this.elements()); elements[i]; i++){ this.check(elements[i]); } return this.valid(); }, element: function(element){ element=this.validationTargetFor(this.clean(element)); this.lastElement=element; this.prepareElement(element); this.currentElements=$(element); var result=this.check(element)!==false; if(result){ delete this.invalid[element.name]; }else{ this.invalid[element.name]=true; } if(!this.numberOfInvalids()){ this.toHide=this.toHide.add(this.containers); } this.showErrors(); return result; }, showErrors: function(errors){ if(errors){ $.extend(this.errorMap, errors); this.errorList=[]; for(var name in errors){ this.errorList.push({ message: errors[name], element: this.findByName(name)[0] }); } this.successList=$.grep(this.successList, function(element){ return !(element.name in errors); }); } if(this.settings.showErrors){ this.settings.showErrors.call(this, this.errorMap, this.errorList); }else{ this.defaultShowErrors(); }}, resetForm: function(){ if($.fn.resetForm){ $(this.currentForm).resetForm(); } this.submitted={}; this.lastElement=null; this.prepareForm(); this.hideErrors(); this.elements().removeClass(this.settings.errorClass).removeData("previousValue"); }, numberOfInvalids: function(){ return this.objectLength(this.invalid); }, objectLength: function(obj){ var count=0; for(var i in obj){ count++; } return count; }, hideErrors: function(){ this.addWrapper(this.toHide).hide(); }, valid: function(){ return this.size()===0; }, size: function(){ return this.errorList.length; }, focusInvalid: function(){ if(this.settings.focusInvalid){ try { $(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]) .filter(":visible") .focus() .trigger("focusin"); } catch(e){ }} }, findLastActive: function(){ var lastActive=this.lastActive; return lastActive&&$.grep(this.errorList, function(n){ return n.element.name===lastActive.name; }).length===1&&lastActive; }, elements: function(){ var validator=this, rulesCache={}; return $(this.currentForm) .find("input, select, textarea") .not(":submit, :reset, :image, [disabled]") .not(this.settings.ignore) .filter(function(){ if(!this.name){ if(window.console){ console.error("%o has no name assigned", this); } throw new Error("Failed to validate, found an element with no name assigned. See console for element reference."); } if(this.name in rulesCache||!validator.objectLength($(this).rules())){ return false; } rulesCache[this.name]=true; return true; }); }, clean: function(selector){ return $(selector)[0]; }, errors: function(){ var errorClass=this.settings.errorClass.replace(" ", "."); return $(this.settings.errorElement + "." + errorClass, this.errorContext); }, reset: function(){ this.successList=[]; this.errorList=[]; this.errorMap={}; this.toShow=$([]); this.toHide=$([]); this.currentElements=$([]); }, prepareForm: function(){ this.reset(); this.toHide=this.errors().add(this.containers); }, prepareElement: function(element){ this.reset(); this.toHide=this.errorsFor(element); }, elementValue: function(element){ var type=$(element).attr("type"), val=$(element).val(); if(type==="radio"||type==="checkbox"){ return $("input[name='" + $(element).attr("name") + "']:checked").val(); } if(typeof val==="string"){ return val.replace(/\r/g, ""); } return val; }, check: function(element){ element=this.validationTargetFor(this.clean(element)); var rules=$(element).rules(); var dependencyMismatch=false; var val=this.elementValue(element); var result; for (var method in rules){ var rule={ method: method, parameters: rules[method] }; try { result=$.validator.methods[method].call(this, val, element, rule.parameters); if(result==="dependency-mismatch"){ dependencyMismatch=true; continue; } dependencyMismatch=false; if(result==="pending"){ this.toHide=this.toHide.not(this.errorsFor(element)); return; } if(!result){ this.formatAndAdd(element, rule); return false; }} catch(e){ if(this.settings.debug&&window.console){ console.log("Exception occured when checking element " + element.id + ", check the '" + rule.method + "' method.", e); } throw e; }} if(dependencyMismatch){ return; } if(this.objectLength(rules)){ this.successList.push(element); } return true; }, customDataMessage: function(element, method){ return $(element).data("msg-" + method.toLowerCase())||(element.attributes&&$(element).attr("data-msg-" + method.toLowerCase())); }, customMessage: function(name, method){ var m=this.settings.messages[name]; return m&&(m.constructor===String ? m:m[method]); }, findDefined: function(){ for(var i=0; i < arguments.length; i++){ if(arguments[i]!==undefined){ return arguments[i]; }} return undefined; }, defaultMessage: function(element, method){ return this.findDefined(this.customMessage(element.name, method), this.customDataMessage(element, method), !this.settings.ignoreTitle&&element.title||undefined, $.validator.messages[method], "Warning: No message defined for " + element.name + "" ); }, formatAndAdd: function(element, rule){ var message=this.defaultMessage(element, rule.method), theregex=/\$?\{(\d+)\}/g; if(typeof message==="function"){ message=message.call(this, rule.parameters, element); }else if(theregex.test(message)){ message=$.validator.format(message.replace(theregex, "{$1}"), rule.parameters); } this.errorList.push({ message: message, element: element }); this.errorMap[element.name]=message; this.submitted[element.name]=message; }, addWrapper: function(toToggle){ if(this.settings.wrapper){ toToggle=toToggle.add(toToggle.parent(this.settings.wrapper)); } return toToggle; }, defaultShowErrors: function(){ var i, elements; for(i=0; this.errorList[i]; i++){ var error=this.errorList[i]; if(this.settings.highlight){ this.settings.highlight.call(this, error.element, this.settings.errorClass, this.settings.validClass); } this.showLabel(error.element, error.message); } if(this.errorList.length){ this.toShow=this.toShow.add(this.containers); } if(this.settings.success){ for(i=0; this.successList[i]; i++){ this.showLabel(this.successList[i]); }} if(this.settings.unhighlight){ for(i=0, elements=this.validElements(); elements[i]; i++){ this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, this.settings.validClass); }} this.toHide=this.toHide.not(this.toShow); this.hideErrors(); this.addWrapper(this.toShow).show(); }, validElements: function(){ return this.currentElements.not(this.invalidElements()); }, invalidElements: function(){ return $(this.errorList).map(function(){ return this.element; }); }, showLabel: function(element, message){ var label=this.errorsFor(element); if(label.length){ label.removeClass(this.settings.validClass).addClass(this.settings.errorClass); if(label.attr("generated")){ label.html(message); }}else{ label=$("<" + this.settings.errorElement + "/>") .attr({"for": this.idOrName(element), generated: true}) .addClass(this.settings.errorClass) .html(message||""); if(this.settings.wrapper){ label=label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); } if(!this.labelContainer.append(label).length){ if(this.settings.errorPlacement){ this.settings.errorPlacement(label, $(element)); }else{ label.insertAfter(element); }} } if(!message&&this.settings.success){ label.text(""); if(typeof this.settings.success==="string"){ label.addClass(this.settings.success); }else{ this.settings.success(label, element); }} this.toShow=this.toShow.add(label); }, errorsFor: function(element){ var name=this.idOrName(element); return this.errors().filter(function(){ return $(this).attr("for")===name; }); }, idOrName: function(element){ return this.groups[element.name]||(this.checkable(element) ? element.name:element.id||element.name); }, validationTargetFor: function(element){ if(this.checkable(element)){ element=this.findByName(element.name).not(this.settings.ignore)[0]; } return element; }, checkable: function(element){ return (/radio|checkbox/i).test(element.type); }, findByName: function(name){ return $(this.currentForm).find("[name='" + name + "']"); }, getLength: function(value, element){ switch(element.nodeName.toLowerCase()){ case "select": return $("option:selected", element).length; case "input": if(this.checkable(element)){ return this.findByName(element.name).filter(":checked").length; }} return value.length; }, depend: function(param, element){ return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element):true; }, dependTypes: { "boolean": function(param, element){ return param; }, "string": function(param, element){ return !!$(param, element.form).length; }, "function": function(param, element){ return param(element); }}, optional: function(element){ var val=this.elementValue(element); return !$.validator.methods.required.call(this, val, element)&&"dependency-mismatch"; }, startRequest: function(element){ if(!this.pending[element.name]){ this.pendingRequest++; this.pending[element.name]=true; }}, stopRequest: function(element, valid){ this.pendingRequest--; if(this.pendingRequest < 0){ this.pendingRequest=0; } delete this.pending[element.name]; if(valid&&this.pendingRequest===0&&this.formSubmitted&&this.form()){ $(this.currentForm).submit(); this.formSubmitted=false; }else if(!valid&&this.pendingRequest===0&&this.formSubmitted){ $(this.currentForm).triggerHandler("invalid-form", [this]); this.formSubmitted=false; }}, previousValue: function(element){ return $.data(element, "previousValue")||$.data(element, "previousValue", { old: null, valid: true, message: this.defaultMessage(element, "remote") }); }}, classRuleSettings: { required: {required: true}, email: {email: true}, url: {url: true}, date: {date: true}, dateISO: {dateISO: true}, number: {number: true}, digits: {digits: true}, creditcard: {creditcard: true}}, addClassRules: function(className, rules){ if(className.constructor===String){ this.classRuleSettings[className]=rules; }else{ $.extend(this.classRuleSettings, className); }}, classRules: function(element){ var rules={}; var classes=$(element).attr("class"); if(classes){ $.each(classes.split(" "), function(){ if(this in $.validator.classRuleSettings){ $.extend(rules, $.validator.classRuleSettings[this]); }}); } return rules; }, attributeRules: function(element){ var rules={}; var $element=$(element); for (var method in $.validator.methods){ var value; if(method==="required"){ value=$element.get(0).getAttribute(method); if(value===""){ value=true; } value = !!value; }else{ value=$element.attr(method); } if(value){ rules[method]=value; }else if($element[0].getAttribute("type")===method){ rules[method]=true; }} if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){ delete rules.maxlength; } return rules; }, dataRules: function(element){ var method, value, rules={}, $element=$(element); for (method in $.validator.methods){ value=$element.data("rule-" + method.toLowerCase()); if(value!==undefined){ rules[method]=value; }} return rules; }, staticRules: function(element){ var rules={}; var validator=$.data(element.form, "validator"); if(validator.settings.rules){ rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};} return rules; }, normalizeRules: function(rules, element){ $.each(rules, function(prop, val){ if(val===false){ delete rules[prop]; return; } if(val.param||val.depends){ var keepRule=true; switch (typeof val.depends){ case "string": keepRule = !!$(val.depends, element.form).length; break; case "function": keepRule=val.depends.call(element, element); break; } if(keepRule){ rules[prop]=val.param!==undefined ? val.param:true; }else{ delete rules[prop]; }} }); $.each(rules, function(rule, parameter){ rules[rule]=$.isFunction(parameter) ? parameter(element):parameter; }); $.each(["minlength", "maxlength", "min", "max"], function(){ if(rules[this]){ rules[this]=Number(rules[this]); }}); $.each(["rangelength", "range"], function(){ var parts; if(rules[this]){ if($.isArray(rules[this])){ rules[this]=[Number(rules[this][0]), Number(rules[this][1])]; }else if(typeof rules[this]==="string"){ parts=rules[this].split(/[\s,]+/); rules[this]=[Number(parts[0]), Number(parts[1])]; }} }); if($.validator.autoCreateRanges){ if(rules.min&&rules.max){ rules.range=[rules.min, rules.max]; delete rules.min; delete rules.max; } if(rules.minlength&&rules.maxlength){ rules.rangelength=[rules.minlength, rules.maxlength]; delete rules.minlength; delete rules.maxlength; }} return rules; }, normalizeRule: function(data){ if(typeof data==="string"){ var transformed={}; $.each(data.split(/\s/), function(){ transformed[this]=true; }); data=transformed; } return data; }, addMethod: function(name, method, message){ $.validator.methods[name]=method; $.validator.messages[name]=message!==undefined ? message:$.validator.messages[name]; if(method.length < 3){ $.validator.addClassRules(name, $.validator.normalizeRule(name)); }}, methods: { required: function(value, element, param){ if(!this.depend(param, element)){ return "dependency-mismatch"; } if(element.nodeName.toLowerCase()==="select"){ var val=$(element).val(); return val&&val.length > 0; } if(this.checkable(element)){ return this.getLength(value, element) > 0; } return $.trim(value).length > 0; }, remote: function(value, element, param){ if(this.optional(element)){ return "dependency-mismatch"; } var previous=this.previousValue(element); if(!this.settings.messages[element.name]){ this.settings.messages[element.name]={};} previous.originalMessage=this.settings.messages[element.name].remote; this.settings.messages[element.name].remote=previous.message; param=typeof param==="string"&&{url:param}||param; if(previous.old===value){ return previous.valid; } previous.old=value; var validator=this; this.startRequest(element); var data={}; data[element.name]=value; $.ajax($.extend(true, { url: param, mode: "abort", port: "validate" + element.name, dataType: "json", data: data, success: function(response){ validator.settings.messages[element.name].remote=previous.originalMessage; var valid=response===true||response==="true"; if(valid){ var submitted=validator.formSubmitted; validator.prepareElement(element); validator.formSubmitted=submitted; validator.successList.push(element); delete validator.invalid[element.name]; validator.showErrors(); }else{ var errors={}; var message=response||validator.defaultMessage(element, "remote"); errors[element.name]=previous.message=$.isFunction(message) ? message(value):message; validator.invalid[element.name]=true; validator.showErrors(errors); } previous.valid=valid; validator.stopRequest(element, valid); }}, param)); return "pending"; }, minlength: function(value, element, param){ var length=$.isArray(value) ? value.length:this.getLength($.trim(value), element); return this.optional(element)||length >=param; }, maxlength: function(value, element, param){ var length=$.isArray(value) ? value.length:this.getLength($.trim(value), element); return this.optional(element)||length <=param; }, rangelength: function(value, element, param){ var length=$.isArray(value) ? value.length:this.getLength($.trim(value), element); return this.optional(element)||(length >=param[0]&&length <=param[1]); }, min: function(value, element, param){ return this.optional(element)||value >=param; }, max: function(value, element, param){ return this.optional(element)||value <=param; }, range: function(value, element, param){ return this.optional(element)||(value >=param[0]&&value <=param[1]); }, email: function(value, element){ return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value); }, url: function(value, element){ return this.optional(element)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); }, date: function(value, element){ return this.optional(element)||!/Invalid|NaN/.test(new Date(value).toString()); }, dateISO: function(value, element){ return this.optional(element)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); }, number: function(value, element){ return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); }, digits: function(value, element){ return this.optional(element)||/^\d+$/.test(value); }, creditcard: function(value, element){ if(this.optional(element)){ return "dependency-mismatch"; } if(/[^0-9 \-]+/.test(value)){ return false; } var nCheck=0, nDigit=0, bEven=false; value=value.replace(/\D/g, ""); for (var n=value.length - 1; n >=0; n--){ var cDigit=value.charAt(n); nDigit=parseInt(cDigit, 10); if(bEven){ if((nDigit *=2) > 9){ nDigit -=9; }} nCheck +=nDigit; bEven = !bEven; } return (nCheck % 10)===0; }, equalTo: function(value, element, param){ var target=$(param); if(this.settings.onfocusout){ target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function(){ $(element).valid(); }); } return value===target.val(); }} }); $.format=$.validator.format; }(jQuery)); (function($){ var pendingRequests={}; if($.ajaxPrefilter){ $.ajaxPrefilter(function(settings, _, xhr){ var port=settings.port; if(settings.mode==="abort"){ if(pendingRequests[port]){ pendingRequests[port].abort(); } pendingRequests[port]=xhr; }}); }else{ var ajax=$.ajax; $.ajax=function(settings){ var mode=("mode" in settings ? settings:$.ajaxSettings).mode, port=("port" in settings ? settings:$.ajaxSettings).port; if(mode==="abort"){ if(pendingRequests[port]){ pendingRequests[port].abort(); } return (pendingRequests[port]=ajax.apply(this, arguments)); } return ajax.apply(this, arguments); };}}(jQuery)); (function($){ $.extend($.fn, { validateDelegate: function(delegate, type, handler){ return this.bind(type, function(event){ var target=$(event.target); if(target.is(delegate)){ return handler.apply(target, arguments); }}); }}); }(jQuery)); !function(a){"use strict";var e={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"Ae","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"Oe","Ő":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"Ue","Ű":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"ae","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"oe","ő":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"ue","ű":"u","ý":"y","þ":"th","ÿ":"y","ẞ":"SS","ا":"a","أ":"a","إ":"i","آ":"aa","ؤ":"u","ئ":"e","ء":"a","ب":"b","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ي":"y","ى":"a","ة":"h","ﻻ":"la","ﻷ":"laa","ﻹ":"lai","ﻵ":"laa","گ":"g","چ":"ch","پ":"p","ژ":"zh","ک":"k","ی":"y","َ":"a","ً":"an","ِ":"e","ٍ":"en","ُ":"u","ٌ":"on","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","က":"k","ခ":"kh","ဂ":"g","ဃ":"ga","င":"ng","စ":"s","ဆ":"sa","ဇ":"z","စျ":"za","ည":"ny","ဋ":"t","ဌ":"ta","ဍ":"d","ဎ":"da","ဏ":"na","တ":"t","ထ":"ta","ဒ":"d","ဓ":"da","န":"n","ပ":"p","ဖ":"pa","ဗ":"b","ဘ":"ba","မ":"m","ယ":"y","ရ":"ya","လ":"l","ဝ":"w","သ":"th","ဟ":"h","ဠ":"la","အ":"a","ြ":"y","ျ":"ya","ွ":"w","ြွ":"yw","ျွ":"ywa","ှ":"h","ဧ":"e","၏":"-e","ဣ":"i","ဤ":"-i","ဉ":"u","ဦ":"-u","ဩ":"aw","သြော":"aw","ဪ":"aw","၀":"0","၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","္":"","့":"","း":"","č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z","ހ":"h","ށ":"sh","ނ":"n","ރ":"r","ބ":"b","ޅ":"lh","ކ":"k","އ":"a","ވ":"v","މ":"m","ފ":"f","ދ":"dh","ތ":"th","ލ":"l","ގ":"g","ޏ":"gn","ސ":"s","ޑ":"d","ޒ":"z","ޓ":"t","ޔ":"y","ޕ":"p","ޖ":"j","ޗ":"ch","ޘ":"tt","ޙ":"hh","ޚ":"kh","ޛ":"th","ޜ":"z","ޝ":"sh","ޞ":"s","ޟ":"d","ޠ":"t","ޡ":"z","ޢ":"a","ޣ":"gh","ޤ":"q","ޥ":"w","ަ":"a","ާ":"aa","ި":"i","ީ":"ee","ު":"u","ޫ":"oo","ެ":"e","ޭ":"ey","ޮ":"o","ޯ":"oa","ް":"","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"p","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","α":"a","β":"v","γ":"g","δ":"d","ε":"e","ζ":"z","η":"i","θ":"th","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"ks","ο":"o","π":"p","ρ":"r","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"o","ά":"a","έ":"e","ί":"i","ό":"o","ύ":"y","ή":"i","ώ":"o","ς":"s","ϊ":"i","ΰ":"y","ϋ":"y","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"I","Θ":"TH","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"KS","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"O","Ά":"A","Έ":"E","Ί":"I","Ό":"O","Ύ":"Y","Ή":"I","Ώ":"O","Ϊ":"I","Ϋ":"Y","ā":"a","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","ū":"u","Ā":"A","Ē":"E","Ģ":"G","Ī":"I","Ķ":"k","Ļ":"L","Ņ":"N","Ū":"U","Ќ":"Kj","ќ":"kj","Љ":"Lj","љ":"lj","Њ":"Nj","њ":"nj","Тс":"Ts","тс":"ts","ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"E","Ł":"L","Ń":"N","Ś":"S","Ź":"Z","Ż":"Z","Є":"Ye","І":"I","Ї":"Yi","Ґ":"G","є":"ye","і":"i","ї":"yi","ґ":"g","ă":"a","Ă":"A","ș":"s","Ș":"S","ț":"t","Ț":"T","ţ":"t","Ţ":"T","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"i","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"kh","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"I","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"Kh","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","ђ":"dj","ј":"j","ћ":"c","џ":"dz","Ђ":"Dj","Ј":"j","Ћ":"C","Џ":"Dz","ľ":"l","ĺ":"l","ŕ":"r","Ľ":"L","Ĺ":"L","Ŕ":"R","ş":"s","Ş":"S","ı":"i","İ":"I","ğ":"g","Ğ":"G","ả":"a","Ả":"A","ẳ":"a","Ẳ":"A","ẩ":"a","Ẩ":"A","đ":"d","Đ":"D","ẹ":"e","Ẹ":"E","ẽ":"e","Ẽ":"E","ẻ":"e","Ẻ":"E","ế":"e","Ế":"E","ề":"e","Ề":"E","ệ":"e","Ệ":"E","ễ":"e","Ễ":"E","ể":"e","Ể":"E","ỏ":"o","ọ":"o","Ọ":"o","ố":"o","Ố":"O","ồ":"o","Ồ":"O","ổ":"o","Ổ":"O","ộ":"o","Ộ":"O","ỗ":"o","Ỗ":"O","ơ":"o","Ơ":"O","ớ":"o","Ớ":"O","ờ":"o","Ờ":"O","ợ":"o","Ợ":"O","ỡ":"o","Ỡ":"O","Ở":"o","ở":"o","ị":"i","Ị":"I","ĩ":"i","Ĩ":"I","ỉ":"i","Ỉ":"i","ủ":"u","Ủ":"U","ụ":"u","Ụ":"U","ũ":"u","Ũ":"U","ư":"u","Ư":"U","ứ":"u","Ứ":"U","ừ":"u","Ừ":"U","ự":"u","Ự":"U","ữ":"u","Ữ":"U","ử":"u","Ử":"ư","ỷ":"y","Ỷ":"y","ỳ":"y","Ỳ":"Y","ỵ":"y","Ỵ":"Y","ỹ":"y","Ỹ":"Y","ạ":"a","Ạ":"A","ấ":"a","Ấ":"A","ầ":"a","Ầ":"A","ậ":"a","Ậ":"A","ẫ":"a","Ẫ":"A","ắ":"a","Ắ":"A","ằ":"a","Ằ":"A","ặ":"a","Ặ":"A","ẵ":"a","Ẵ":"A","⓪":"0","①":"1","②":"2","③":"3","④":"4","⑤":"5","⑥":"6","⑦":"7","⑧":"8","⑨":"9","⑩":"10","⑪":"11","⑫":"12","⑬":"13","⑭":"14","⑮":"15","⑯":"16","⑰":"17","⑱":"18","⑲":"18","⑳":"18","⓵":"1","⓶":"2","⓷":"3","⓸":"4","⓹":"5","⓺":"6","⓻":"7","⓼":"8","⓽":"9","⓾":"10","⓿":"0","⓫":"11","⓬":"12","⓭":"13","⓮":"14","⓯":"15","⓰":"16","⓱":"17","⓲":"18","⓳":"19","⓴":"20","Ⓐ":"A","Ⓑ":"B","Ⓒ":"C","Ⓓ":"D","Ⓔ":"E","Ⓕ":"F","Ⓖ":"G","Ⓗ":"H","Ⓘ":"I","Ⓙ":"J","Ⓚ":"K","Ⓛ":"L","Ⓜ":"M","Ⓝ":"N","Ⓞ":"O","Ⓟ":"P","Ⓠ":"Q","Ⓡ":"R","Ⓢ":"S","Ⓣ":"T","Ⓤ":"U","Ⓥ":"V","Ⓦ":"W","Ⓧ":"X","Ⓨ":"Y","Ⓩ":"Z","ⓐ":"a","ⓑ":"b","ⓒ":"c","ⓓ":"d","ⓔ":"e","ⓕ":"f","ⓖ":"g","ⓗ":"h","ⓘ":"i","ⓙ":"j","ⓚ":"k","ⓛ":"l","ⓜ":"m","ⓝ":"n","ⓞ":"o","ⓟ":"p","ⓠ":"q","ⓡ":"r","ⓢ":"s","ⓣ":"t","ⓤ":"u","ⓦ":"v","ⓥ":"w","ⓧ":"x","ⓨ":"y","ⓩ":"z","“":'"',"”":'"',"‘":"'","’":"'","∂":"d","ƒ":"f","™":"(TM)","©":"(C)","œ":"oe","Œ":"OE","®":"(R)","†":"+","℠":"(SM)","…":"...","˚":"o","º":"o","ª":"a","•":"*","၊":",","။":".",$:"USD","€":"EUR","₢":"BRN","₣":"FRF","£":"GBP","₤":"ITL","₦":"NGN","₧":"ESP","₩":"KRW","₪":"ILS","₫":"VND","₭":"LAK","₮":"MNT","₯":"GRD","₱":"ARS","₲":"PYG","₳":"ARA","₴":"UAH","₵":"GHS","¢":"cent","¥":"CNY","元":"CNY","円":"YEN","﷼":"IRR","₠":"EWE","฿":"THB","₨":"INR","₹":"INR","₰":"PF","₺":"TRY","؋":"AFN","₼":"AZN","лв":"BGN","៛":"KHR","₡":"CRC","₸":"KZT","ден":"MKD","zł":"PLN","₽":"RUB","₾":"GEL"},n=["်","ް"],t={"ာ":"a","ါ":"a","ေ":"e","ဲ":"e","ိ":"i","ီ":"i","ို":"o","ု":"u","ူ":"u","ေါင်":"aung","ော":"aw","ော်":"aw","ေါ":"aw","ေါ်":"aw","်":"်","က်":"et","ိုက်":"aik","ောက်":"auk","င်":"in","ိုင်":"aing","ောင်":"aung","စ်":"it","ည်":"i","တ်":"at","ိတ်":"eik","ုတ်":"ok","ွတ်":"ut","ေတ်":"it","ဒ်":"d","ိုဒ်":"ok","ုဒ်":"ait","န်":"an","ာန်":"an","ိန်":"ein","ုန်":"on","ွန်":"un","ပ်":"at","ိပ်":"eik","ုပ်":"ok","ွပ်":"ut","န်ုပ်":"nub","မ်":"an","ိမ်":"ein","ုမ်":"on","ွမ်":"un","ယ်":"e","ိုလ်":"ol","ဉ်":"in","ံ":"an","ိံ":"ein","ုံ":"on","ައް":"ah","ަށް":"ah"},i={en:{},az:{"ç":"c","ə":"e","ğ":"g","ı":"i","ö":"o","ş":"s","ü":"u","Ç":"C","Ə":"E","Ğ":"G","İ":"I","Ö":"O","Ş":"S","Ü":"U"},cs:{"č":"c","ď":"d","ě":"e","ň":"n","ř":"r","š":"s","ť":"t","ů":"u","ž":"z","Č":"C","Ď":"D","Ě":"E","Ň":"N","Ř":"R","Š":"S","Ť":"T","Ů":"U","Ž":"Z"},fi:{"ä":"a","Ä":"A","ö":"o","Ö":"O"},hu:{"ä":"a","Ä":"A","ö":"o","Ö":"O","ü":"u","Ü":"U","ű":"u","Ű":"U"},lt:{"ą":"a","č":"c","ę":"e","ė":"e","į":"i","š":"s","ų":"u","ū":"u","ž":"z","Ą":"A","Č":"C","Ę":"E","Ė":"E","Į":"I","Š":"S","Ų":"U","Ū":"U"},lv:{"ā":"a","č":"c","ē":"e","ģ":"g","ī":"i","ķ":"k","ļ":"l","ņ":"n","š":"s","ū":"u","ž":"z","Ā":"A","Č":"C","Ē":"E","Ģ":"G","Ī":"i","Ķ":"k","Ļ":"L","Ņ":"N","Š":"S","Ū":"u","Ž":"Z"},pl:{"ą":"a","ć":"c","ę":"e","ł":"l","ń":"n","ó":"o","ś":"s","ź":"z","ż":"z","Ą":"A","Ć":"C","Ę":"e","Ł":"L","Ń":"N","Ó":"O","Ś":"S","Ź":"Z","Ż":"Z"},sv:{"ä":"a","Ä":"A","ö":"o","Ö":"O"},sk:{"ä":"a","Ä":"A"},sr:{"љ":"lj","њ":"nj","Љ":"Lj","Њ":"Nj","đ":"dj","Đ":"Dj"},tr:{"Ü":"U","Ö":"O","ü":"u","ö":"o"}},o={ar:{"∆":"delta","∞":"la-nihaya","♥":"hob","&":"wa","|":"aw","<":"aqal-men",">":"akbar-men","∑":"majmou","¤":"omla"},az:{},ca:{"∆":"delta","∞":"infinit","♥":"amor","&":"i","|":"o","<":"menys que",">":"mes que","∑":"suma dels","¤":"moneda"},cs:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"nebo","<":"mensi nez",">":"vetsi nez","∑":"soucet","¤":"mena"},de:{"∆":"delta","∞":"unendlich","♥":"Liebe","&":"und","|":"oder","<":"kleiner als",">":"groesser als","∑":"Summe von","¤":"Waehrung"},dv:{"∆":"delta","∞":"kolunulaa","♥":"loabi","&":"aai","|":"noonee","<":"ah vure kuda",">":"ah vure bodu","∑":"jumula","¤":"faisaa"},en:{"∆":"delta","∞":"infinity","♥":"love","&":"and","|":"or","<":"less than",">":"greater than","∑":"sum","¤":"currency"},es:{"∆":"delta","∞":"infinito","♥":"amor","&":"y","|":"u","<":"menos que",">":"mas que","∑":"suma de los","¤":"moneda"},fa:{"∆":"delta","∞":"bi-nahayat","♥":"eshgh","&":"va","|":"ya","<":"kamtar-az",">":"bishtar-az","∑":"majmooe","¤":"vahed"},fi:{"∆":"delta","∞":"aarettomyys","♥":"rakkaus","&":"ja","|":"tai","<":"pienempi kuin",">":"suurempi kuin","∑":"summa","¤":"valuutta"},fr:{"∆":"delta","∞":"infiniment","♥":"Amour","&":"et","|":"ou","<":"moins que",">":"superieure a","∑":"somme des","¤":"monnaie"},ge:{"∆":"delta","∞":"usasruloba","♥":"siqvaruli","&":"da","|":"an","<":"naklebi",">":"meti","∑":"jami","¤":"valuta"},gr:{},hu:{"∆":"delta","∞":"vegtelen","♥":"szerelem","&":"es","|":"vagy","<":"kisebb mint",">":"nagyobb mint","∑":"szumma","¤":"penznem"},it:{"∆":"delta","∞":"infinito","♥":"amore","&":"e","|":"o","<":"minore di",">":"maggiore di","∑":"somma","¤":"moneta"},lt:{"∆":"delta","∞":"begalybe","♥":"meile","&":"ir","|":"ar","<":"maziau nei",">":"daugiau nei","∑":"suma","¤":"valiuta"},lv:{"∆":"delta","∞":"bezgaliba","♥":"milestiba","&":"un","|":"vai","<":"mazak neka",">":"lielaks neka","∑":"summa","¤":"valuta"},my:{"∆":"kwahkhyaet","∞":"asaonasme","♥":"akhyait","&":"nhin","|":"tho","<":"ngethaw",">":"kyithaw","∑":"paungld","¤":"ngwekye"},mk:{},nl:{"∆":"delta","∞":"oneindig","♥":"liefde","&":"en","|":"of","<":"kleiner dan",">":"groter dan","∑":"som","¤":"valuta"},pl:{"∆":"delta","∞":"nieskonczonosc","♥":"milosc","&":"i","|":"lub","<":"mniejsze niz",">":"wieksze niz","∑":"suma","¤":"waluta"},pt:{"∆":"delta","∞":"infinito","♥":"amor","&":"e","|":"ou","<":"menor que",">":"maior que","∑":"soma","¤":"moeda"},ro:{"∆":"delta","∞":"infinit","♥":"dragoste","&":"si","|":"sau","<":"mai mic ca",">":"mai mare ca","∑":"suma","¤":"valuta"},ru:{"∆":"delta","∞":"beskonechno","♥":"lubov","&":"i","|":"ili","<":"menshe",">":"bolshe","∑":"summa","¤":"valjuta"},sk:{"∆":"delta","∞":"nekonecno","♥":"laska","&":"a","|":"alebo","<":"menej ako",">":"viac ako","∑":"sucet","¤":"mena"},sr:{},tr:{"∆":"delta","∞":"sonsuzluk","♥":"ask","&":"ve","|":"veya","<":"kucuktur",">":"buyuktur","∑":"toplam","¤":"para birimi"},uk:{"∆":"delta","∞":"bezkinechnist","♥":"lubov","&":"i","|":"abo","<":"menshe",">":"bilshe","∑":"suma","¤":"valjuta"},vn:{"∆":"delta","∞":"vo cuc","♥":"yeu","&":"va","|":"hoac","<":"nho hon",">":"lon hon","∑":"tong","¤":"tien te"}},u=[";","?",":","@","&","=","+","$",",","/"].join(""),s=[";","?",":","@","&","=","+","$",","].join(""),l=[".","!","~","*","'","(",")"].join(""),r=function(a,r){var m,d,g,k,y,f,p,z,b,A,v,E,O,j,S="-",w="",U="",C=!0,N={},R="";if("string"!=typeof a)return"";if("string"==typeof r&&(S=r),p=o.en,z=i.en,"object"==typeof r){m=r.maintainCase||!1,N=r.custom&&"object"==typeof r.custom?r.custom:N,g=+r.truncate>1&&r.truncate||!1,k=r.uric||!1,y=r.uricNoSlash||!1,f=r.mark||!1,C=!1!==r.symbols&&!1!==r.lang,S=r.separator||S,k&&(R+=u),y&&(R+=s),f&&(R+=l),p=r.lang&&o[r.lang]&&C?o[r.lang]:C?o.en:{},z=r.lang&&i[r.lang]?i[r.lang]:!1===r.lang||!0===r.lang?{}:i.en,r.titleCase&&"number"==typeof r.titleCase.length&&Array.prototype.toString.call(r.titleCase)?(r.titleCase.forEach(function(a){N[a+""]=a+""}),d=!0):d=!!r.titleCase,r.custom&&"number"==typeof r.custom.length&&Array.prototype.toString.call(r.custom)&&r.custom.forEach(function(a){N[a+""]=a+""}),Object.keys(N).forEach(function(e){var n;n=e.length>1?new RegExp("\\b"+h(e)+"\\b","gi"):new RegExp(h(e),"gi"),a=a.replace(n,N[e])});for(v in N)R+=v}for(R=h(R+=S),O=!1,j=!1,A=0,E=(a=a.replace(/(^\s+|\s+$)/g,"")).length;A=0?(U+=v,v=""):!0===j?(v=t[U]+e[v],U=""):v=O&&e[v].match(/[A-Za-z0-9]/)?" "+e[v]:e[v],O=!1,j=!1):v in t?(U+=v,v="",A===E-1&&(v=t[U]),j=!0):!p[v]||k&&-1!==u.indexOf(v)||y&&-1!==s.indexOf(v)?(!0===j?(v=t[U]+v,U="",j=!1):O&&(/[A-Za-z0-9]/.test(v)||w.substr(-1).match(/A-Za-z0-9]/))&&(v=" "+v),O=!1):(v=O||w.substr(-1).match(/[A-Za-z0-9]/)?S+p[v]:p[v],v+=void 0!==a[A+1]&&a[A+1].match(/[A-Za-z0-9]/)?S:"",O=!0),w+=v.replace(new RegExp("[^\\w\\s"+R+"_-]","g"),S);return d&&(w=w.replace(/(\w)(\S*)/g,function(a,e,n){var t=e.toUpperCase()+(null!==n?n:"");return Object.keys(N).indexOf(t.toLowerCase())<0?t:t.toLowerCase()})),w=w.replace(/\s+/g,S).replace(new RegExp("\\"+S+"+","g"),S).replace(new RegExp("(^\\"+S+"+|\\"+S+"+$)","g"),""),g&&w.length>g&&(b=w.charAt(g)===S,w=w.slice(0,g),b||(w=w.slice(0,w.lastIndexOf(S)))),m||d||(w=w.toLowerCase()),w},m=function(a){return function(e){return r(e,a)}},h=function(a){return a.replace(/[-\\^$*+?.()|[\]{}\/]/g,"\\$&")},c=function(a,e){for(var n in e)if(e[n]===a)return!0};if("undefined"!=typeof module&&module.exports)module.exports=r,module.exports.createSlug=m;else if("undefined"!=typeof define&&define.amd)define([],function(){return r});else try{if(a.getSlug||a.createSlug)throw"speakingurl: globals exists /(getSlug|createSlug)/";a.getSlug=r,a.createSlug=m}catch(a){}}(this); (function (root, undef){ var ArrayProto=Array.prototype, ObjProto=Object.prototype, slice=ArrayProto.slice, hasOwnProp=ObjProto.hasOwnProperty, nativeForEach=ArrayProto.forEach, breaker={}; var _={ forEach:function(obj, iterator, context){ var i, l, key; if(obj===null){ return; } if(nativeForEach&&obj.forEach===nativeForEach){ obj.forEach(iterator, context); } else if(obj.length===+obj.length){ for(i=0, l=obj.length; i < l; i++){ if(i in obj&&iterator.call(context, obj[i], i, obj)===breaker){ return; }} }else{ for(key in obj){ if(hasOwnProp.call(obj, key)){ if(iterator.call (context, obj[key], key, obj)===breaker){ return; }} }} }, extend:function(obj){ this.forEach(slice.call(arguments, 1), function(source){ for(var prop in source){ obj[prop]=source[prop]; }}); return obj; }}; var Jed=function(options){ this.defaults={ "locale_data":{ "messages":{ "":{ "domain":"messages", "lang":"en", "plural_forms":"nplurals=2; plural=(n!=1);" }} }, "domain":"messages", "debug":false }; this.options=_.extend({}, this.defaults, options); this.textdomain(this.options.domain); if(options.domain&&! this.options.locale_data[ this.options.domain ]){ throw new Error('Text domain set to non-existent domain: `' + options.domain + '`'); }}; Jed.context_delimiter=String.fromCharCode(4); function getPluralFormFunc(plural_form_string){ return Jed.PF.compile(plural_form_string||"nplurals=2; plural=(n!=1);"); } function Chain(key, i18n){ this._key=key; this._i18n=i18n; } _.extend(Chain.prototype, { onDomain:function(domain){ this._domain=domain; return this; }, withContext:function(context){ this._context=context; return this; }, ifPlural:function(num, pkey){ this._val=num; this._pkey=pkey; return this; }, fetch:function(sArr){ if({}.toString.call(sArr)!='[object Array]'){ sArr=[].slice.call(arguments, 0); } return(sArr&&sArr.length ? Jed.sprintf:function(x){ return x; })( this._i18n.dcnpgettext(this._domain, this._context, this._key, this._pkey, this._val), sArr ); }}); _.extend(Jed.prototype, { translate:function(key){ return new Chain(key, this); }, textdomain:function(domain){ if(! domain){ return this._textdomain; } this._textdomain=domain; }, gettext:function(key){ return this.dcnpgettext.call(this, undef, undef, key); }, dgettext:function(domain, key){ return this.dcnpgettext.call(this, domain, undef, key); }, dcgettext:function(domain , key ){ return this.dcnpgettext.call(this, domain, undef, key); }, ngettext:function(skey, pkey, val){ return this.dcnpgettext.call(this, undef, undef, skey, pkey, val); }, dngettext:function(domain, skey, pkey, val){ return this.dcnpgettext.call(this, domain, undef, skey, pkey, val); }, dcngettext:function(domain, skey, pkey, val){ return this.dcnpgettext.call(this, domain, undef, skey, pkey, val); }, pgettext:function(context, key){ return this.dcnpgettext.call(this, undef, context, key); }, dpgettext:function(domain, context, key){ return this.dcnpgettext.call(this, domain, context, key); }, dcpgettext:function(domain, context, key){ return this.dcnpgettext.call(this, domain, context, key); }, npgettext:function(context, skey, pkey, val){ return this.dcnpgettext.call(this, undef, context, skey, pkey, val); }, dnpgettext:function(domain, context, skey, pkey, val){ return this.dcnpgettext.call(this, domain, context, skey, pkey, val); }, dcnpgettext:function(domain, context, singular_key, plural_key, val){ plural_key=plural_key||singular_key; domain=domain||this._textdomain; var fallback; if(! this.options){ fallback=new Jed(); return fallback.dcnpgettext.call(fallback, undefined, undefined, singular_key, plural_key, val); } if(! this.options.locale_data){ throw new Error('No locale data provided.'); } if(! this.options.locale_data[ domain ]){ throw new Error('Domain `' + domain + '` was not found.'); } if(! this.options.locale_data[ domain ][ "" ]){ throw new Error('No locale meta information provided.'); } if(! singular_key){ throw new Error('No translation key found.'); } var key=context ? context + Jed.context_delimiter + singular_key:singular_key, locale_data=this.options.locale_data, dict=locale_data[ domain ], defaultConf=(locale_data.messages||this.defaults.locale_data.messages)[""], pluralForms=dict[""].plural_forms||dict[""]["Plural-Forms"]||dict[""]["plural-forms"]||defaultConf.plural_forms||defaultConf["Plural-Forms"]||defaultConf["plural-forms"], val_list, res; var val_idx; if(val===undefined){ val_idx=0; }else{ if(typeof val!='number'){ val=parseInt(val, 10); if(isNaN(val)){ throw new Error('The number that was passed in is not a number.'); }} val_idx=getPluralFormFunc(pluralForms)(val); } if(! dict){ throw new Error('No domain named `' + domain + '` could be found.'); } val_list=dict[ key ]; if(! val_list||val_idx > val_list.length){ if(this.options.missing_key_callback){ this.options.missing_key_callback(key, domain); } res=[ singular_key, plural_key ]; if(this.options.debug===true){ console.log(res[ getPluralFormFunc(pluralForms)(val) ]); } return res[ getPluralFormFunc()(val) ]; } res=val_list[ val_idx ]; if(! res){ res=[ singular_key, plural_key ]; return res[ getPluralFormFunc()(val) ]; } return res; }}); var sprintf=(function(){ function get_type(variable){ return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase(); } function str_repeat(input, multiplier){ for (var output=[]; multiplier > 0; output[--multiplier]=input){} return output.join(''); } var str_format=function(){ if(!str_format.cache.hasOwnProperty(arguments[0])){ str_format.cache[arguments[0]]=str_format.parse(arguments[0]); } return str_format.format.call(null, str_format.cache[arguments[0]], arguments); }; str_format.format=function(parse_tree, argv){ var cursor=1, tree_length=parse_tree.length, node_type='', arg, output=[], i, k, match, pad, pad_character, pad_length; for (i=0; i < tree_length; i++){ node_type=get_type(parse_tree[i]); if(node_type==='string'){ output.push(parse_tree[i]); } else if(node_type==='array'){ match=parse_tree[i]; if(match[2]){ arg=argv[cursor]; for (k=0; k < match[2].length; k++){ if(!arg.hasOwnProperty(match[2][k])){ throw(sprintf('[sprintf] property "%s" does not exist', match[2][k])); } arg=arg[match[2][k]]; }} else if(match[1]){ arg=argv[match[1]]; }else{ arg=argv[cursor++]; } if(/[^s]/.test(match[8])&&(get_type(arg)!='number')){ throw(sprintf('[sprintf] expecting number but found %s', get_type(arg))); } if(typeof arg=='undefined'||arg===null){ arg=''; } switch (match[8]){ case 'b': arg=arg.toString(2); break; case 'c': arg=String.fromCharCode(arg); break; case 'd': arg=parseInt(arg, 10); break; case 'e': arg=match[7] ? arg.toExponential(match[7]):arg.toExponential(); break; case 'f': arg=match[7] ? parseFloat(arg).toFixed(match[7]):parseFloat(arg); break; case 'o': arg=arg.toString(8); break; case 's': arg=((arg=String(arg))&&match[7] ? arg.substring(0, match[7]):arg); break; case 'u': arg=Math.abs(arg); break; case 'x': arg=arg.toString(16); break; case 'X': arg=arg.toString(16).toUpperCase(); break; } arg=(/[def]/.test(match[8])&&match[3]&&arg >=0 ? '+'+ arg:arg); pad_character=match[4] ? match[4]=='0' ? '0':match[4].charAt(1):' '; pad_length=match[6] - String(arg).length; pad=match[6] ? str_repeat(pad_character, pad_length):''; output.push(match[5] ? arg + pad:pad + arg); }} return output.join(''); }; str_format.cache={}; str_format.parse=function(fmt){ var _fmt=fmt, match=[], parse_tree=[], arg_names=0; while (_fmt){ if((match=/^[^\x25]+/.exec(_fmt))!==null){ parse_tree.push(match[0]); } else if((match=/^\x25{2}/.exec(_fmt))!==null){ parse_tree.push('%'); } else if((match=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt))!==null){ if(match[2]){ arg_names |=1; var field_list=[], replacement_field=match[2], field_match=[]; if((field_match=/^([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){ field_list.push(field_match[1]); while ((replacement_field=replacement_field.substring(field_match[0].length))!==''){ if((field_match=/^\.([a-z_][a-z_\d]*)/i.exec(replacement_field))!==null){ field_list.push(field_match[1]); } else if((field_match=/^\[(\d+)\]/.exec(replacement_field))!==null){ field_list.push(field_match[1]); }else{ throw('[sprintf] huh?'); }} }else{ throw('[sprintf] huh?'); } match[2]=field_list; }else{ arg_names |=2; } if(arg_names===3){ throw('[sprintf] mixing positional and named placeholders is not (yet) supported'); } parse_tree.push(match); }else{ throw('[sprintf] huh?'); } _fmt=_fmt.substring(match[0].length); } return parse_tree; }; return str_format; })(); var vsprintf=function(fmt, argv){ argv.unshift(fmt); return sprintf.apply(null, argv); }; Jed.parse_plural=function(plural_forms, n){ plural_forms=plural_forms.replace(/n/g, n); return Jed.parse_expression(plural_forms); }; Jed.sprintf=function(fmt, args){ if({}.toString.call(args)=='[object Array]'){ return vsprintf(fmt, [].slice.call(args)); } return sprintf.apply(this, [].slice.call(arguments)); }; Jed.prototype.sprintf=function (){ return Jed.sprintf.apply(this, arguments); }; Jed.PF={}; Jed.PF.parse=function(p){ var plural_str=Jed.PF.extractPluralExpr(p); return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str); }; Jed.PF.compile=function(p){ function imply(val){ return (val===true ? 1:val ? val:0); } var ast=Jed.PF.parse(p); return function(n){ return imply(Jed.PF.interpreter(ast)(n)); };}; Jed.PF.interpreter=function(ast){ return function(n){ var res; switch(ast.type){ case 'GROUP': return Jed.PF.interpreter(ast.expr)(n); case 'TERNARY': if(Jed.PF.interpreter(ast.expr)(n)){ return Jed.PF.interpreter(ast.truthy)(n); } return Jed.PF.interpreter(ast.falsey)(n); case 'OR': return Jed.PF.interpreter(ast.left)(n)||Jed.PF.interpreter(ast.right)(n); case 'AND': return Jed.PF.interpreter(ast.left)(n)&&Jed.PF.interpreter(ast.right)(n); case 'LT': return Jed.PF.interpreter(ast.left)(n) < Jed.PF.interpreter(ast.right)(n); case 'GT': return Jed.PF.interpreter(ast.left)(n) > Jed.PF.interpreter(ast.right)(n); case 'LTE': return Jed.PF.interpreter(ast.left)(n) <=Jed.PF.interpreter(ast.right)(n); case 'GTE': return Jed.PF.interpreter(ast.left)(n) >=Jed.PF.interpreter(ast.right)(n); case 'EQ': return Jed.PF.interpreter(ast.left)(n)==Jed.PF.interpreter(ast.right)(n); case 'NEQ': return Jed.PF.interpreter(ast.left)(n)!=Jed.PF.interpreter(ast.right)(n); case 'MOD': return Jed.PF.interpreter(ast.left)(n) % Jed.PF.interpreter(ast.right)(n); case 'VAR': return n; case 'NUM': return ast.val; default: throw new Error("Invalid Token found."); }};}; Jed.PF.regexps={ TRIM_BEG: /^\s\s*/, TRIM_END: /\s\s*$/, HAS_SEMICOLON: /;\s*$/, NPLURALS: /nplurals\=(\d+);/, PLURAL: /plural\=(.*);/ }; Jed.PF.extractPluralExpr=function(p){ p=p.replace(Jed.PF.regexps.TRIM_BEG, '').replace(Jed.PF.regexps.TRIM_END, ''); if(! Jed.PF.regexps.HAS_SEMICOLON.test(p)){ p=p.concat(';'); } var nplurals_matches=p.match(Jed.PF.regexps.NPLURALS), res={}, plural_matches; if(nplurals_matches.length > 1){ res.nplurals=nplurals_matches[1]; }else{ throw new Error('nplurals not found in plural_forms string: ' + p); } p=p.replace(Jed.PF.regexps.NPLURALS, ""); plural_matches=p.match(Jed.PF.regexps.PLURAL); if(!(plural_matches&&plural_matches.length > 1)){ throw new Error('`plural` expression not found: ' + p); } return plural_matches[ 1 ]; }; Jed.PF.parser=(function(){ var parser={trace: function trace(){ }, yy: {}, symbols_: {"error":2,"expressions":3,"e":4,"EOF":5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,"n":19,"NUMBER":20,"$accept":0,"$end":1}, terminals_: {2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"}, productions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]], performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){ var $0=$$.length - 1; switch (yystate){ case 1: return { type:'GROUP', expr: $$[$0-1] }; break; case 2:this.$={ type: 'TERNARY', expr: $$[$0-4], truthy:$$[$0-2], falsey: $$[$0] }; break; case 3:this.$={ type: "OR", left: $$[$0-2], right: $$[$0] }; break; case 4:this.$={ type: "AND", left: $$[$0-2], right: $$[$0] }; break; case 5:this.$={ type: 'LT', left: $$[$0-2], right: $$[$0] }; break; case 6:this.$={ type: 'LTE', left: $$[$0-2], right: $$[$0] }; break; case 7:this.$={ type: 'GT', left: $$[$0-2], right: $$[$0] }; break; case 8:this.$={ type: 'GTE', left: $$[$0-2], right: $$[$0] }; break; case 9:this.$={ type: 'NEQ', left: $$[$0-2], right: $$[$0] }; break; case 10:this.$={ type: 'EQ', left: $$[$0-2], right: $$[$0] }; break; case 11:this.$={ type: 'MOD', left: $$[$0-2], right: $$[$0] }; break; case 12:this.$={ type: 'GROUP', expr: $$[$0-1] }; break; case 13:this.$={ type: 'VAR' }; break; case 14:this.$={ type: 'NUM', val: Number(yytext) }; break; }}, table: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}], defaultActions: {6:[2,1]}, parseError: function parseError(str, hash){ throw new Error(str); }, parse: function parse(input){ var self=this, stack=[0], vstack=[null], lstack=[], table=this.table, yytext='', yylineno=0, yyleng=0, recovering=0, TERROR=2, EOF=1; this.lexer.setInput(input); this.lexer.yy=this.yy; this.yy.lexer=this.lexer; if(typeof this.lexer.yylloc=='undefined') this.lexer.yylloc={}; var yyloc=this.lexer.yylloc; lstack.push(yyloc); if(typeof this.yy.parseError==='function') this.parseError=this.yy.parseError; function popStack (n){ stack.length=stack.length - 2*n; vstack.length=vstack.length - n; lstack.length=lstack.length - n; } function lex(){ var token; token=self.lexer.lex()||1; if(typeof token!=='number'){ token=self.symbols_[token]||token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; while (true){ state=stack[stack.length-1]; if(this.defaultActions[state]){ action=this.defaultActions[state]; }else{ if(symbol==null) symbol=lex(); action=table[state]&&table[state][symbol]; } _handle_error: if(typeof action==='undefined'||!action.length||!action[0]){ if(!recovering){ expected=[]; for (p in table[state]) if(this.terminals_[p]&&p > 2){ expected.push("'"+this.terminals_[p]+"'"); } var errStr=''; if(this.lexer.showPosition){ errStr='Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; }else{ errStr='Parse error on line '+(yylineno+1)+": Unexpected " + (symbol==1 ? "end of input" : ("'"+(this.terminals_[symbol]||symbol)+"'")); } this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol]||symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); } if(recovering==3){ if(symbol==EOF){ throw new Error(errStr||'Parsing halted.'); } yyleng=this.lexer.yyleng; yytext=this.lexer.yytext; yylineno=this.lexer.yylineno; yyloc=this.lexer.yylloc; symbol=lex(); } while (1){ if((TERROR.toString()) in table[state]){ break; } if(state==0){ throw new Error(errStr||'Parsing halted.'); } popStack(1); state=stack[stack.length-1]; } preErrorSymbol=symbol; symbol=TERROR; state=stack[stack.length-1]; action=table[state]&&table[state][TERROR]; recovering=3; } if(action[0] instanceof Array&&action.length > 1){ throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); } switch (action[0]){ case 1: stack.push(symbol); vstack.push(this.lexer.yytext); lstack.push(this.lexer.yylloc); stack.push(action[1]); symbol=null; if(!preErrorSymbol){ yyleng=this.lexer.yyleng; yytext=this.lexer.yytext; yylineno=this.lexer.yylineno; yyloc=this.lexer.yylloc; if(recovering > 0) recovering--; }else{ symbol=preErrorSymbol; preErrorSymbol=null; } break; case 2: len=this.productions_[action[1]][1]; yyval.$=vstack[vstack.length-len]; yyval._$={ first_line: lstack[lstack.length-(len||1)].first_line, last_line: lstack[lstack.length-1].last_line, first_column: lstack[lstack.length-(len||1)].first_column, last_column: lstack[lstack.length-1].last_column }; r=this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); if(typeof r!=='undefined'){ return r; } if(len){ stack=stack.slice(0,-1*len*2); vstack=vstack.slice(0, -1*len); lstack=lstack.slice(0, -1*len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState=table[stack[stack.length-2]][stack[stack.length-1]]; stack.push(newState); break; case 3: return true; }} return true; }}; var lexer=(function(){ var lexer=({EOF:1, parseError:function parseError(str, hash){ if(this.yy.parseError){ this.yy.parseError(str, hash); }else{ throw new Error(str); }}, setInput:function (input){ this._input=input; this._more=this._less=this.done=false; this.yylineno=this.yyleng=0; this.yytext=this.matched=this.match=''; this.conditionStack=['INITIAL']; this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0}; return this; }, input:function (){ var ch=this._input[0]; this.yytext+=ch; this.yyleng++; this.match+=ch; this.matched+=ch; var lines=ch.match(/\n/); if(lines) this.yylineno++; this._input=this._input.slice(1); return ch; }, unput:function (ch){ this._input=ch + this._input; return this; }, more:function (){ this._more=true; return this; }, pastInput:function (){ var past=this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, upcomingInput:function (){ var next=this.match; if(next.length < 20){ next +=this._input.substr(0, 20-next.length); } return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); }, showPosition:function (){ var pre=this.pastInput(); var c=new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c+"^"; }, next:function (){ if(this.done){ return this.EOF; } if(!this._input) this.done=true; var token, match, col, lines; if(!this._more){ this.yytext=''; this.match=''; } var rules=this._currentRules(); for (var i=0;i < rules.length; i++){ match=this._input.match(this.rules[rules[i]]); if(match){ lines=match[0].match(/\n.*/g); if(lines) this.yylineno +=lines.length; this.yylloc={first_line: this.yylloc.last_line, last_line: this.yylineno+1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length-1].length-1:this.yylloc.last_column + match[0].length} this.yytext +=match[0]; this.match +=match[0]; this.matches=match; this.yyleng=this.yytext.length; this._more=false; this._input=this._input.slice(match[0].length); this.matched +=match[0]; token=this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]); if(token) return token; else return; }} if(this._input===""){ return this.EOF; }else{ this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), {text: "", token: null, line: this.yylineno}); }}, lex:function lex(){ var r=this.next(); if(typeof r!=='undefined'){ return r; }else{ return this.lex(); }}, begin:function begin(condition){ this.conditionStack.push(condition); }, popState:function popState(){ return this.conditionStack.pop(); }, _currentRules:function _currentRules(){ return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; }, topState:function (){ return this.conditionStack[this.conditionStack.length-2]; }, pushState:function begin(condition){ this.begin(condition); }}); lexer.performAction=function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){ var YYSTATE=YY_START; switch($avoiding_name_collisions){ case 0: break; case 1:return 20 break; case 2:return 19 break; case 3:return 8 break; case 4:return 9 break; case 5:return 6 break; case 6:return 7 break; case 7:return 11 break; case 8:return 13 break; case 9:return 10 break; case 10:return 12 break; case 11:return 14 break; case 12:return 15 break; case 13:return 16 break; case 14:return 17 break; case 15:return 18 break; case 16:return 5 break; case 17:return 'INVALID' break; }}; lexer.rules=[/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./]; lexer.conditions={"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}};return lexer;})() parser.lexer=lexer; return parser; })(); if(typeof exports!=='undefined'){ if(typeof module!=='undefined'&&module.exports){ exports=module.exports=Jed; } exports.Jed=Jed; }else{ if(typeof define==='function'&&define.amd){ define(function(){ return Jed; }); } root['Jed']=Jed; }})(this); (function($){ var Dokan_Vendor_Registration={ init: function(){ var form=$('form.register'); $('.user-role input[type=radio]', form).on('change', this.showSellerForm); $('.tc_check_box', form).on('click', this.onTOC); $('#shop-phone', form).keydown(this.ensurePhoneNumber); $('#company-name', form).on('focusout', this.generateSlugFromCompany); $('#seller-url', form).keydown(this.constrainSlug); $('#seller-url', form).keyup(this.renderUrl); $('#seller-url', form).on('focusout', this.checkSlugAvailability); this.validationLocalized(); }, validate: function(self){ $('form.register').validate({ errorPlacement: function(error, element){ var form_group=$(element).closest('.form-group'); form_group.addClass('has-error').append(error); }, success: function(label, element){ $(element).closest('.form-group').removeClass('has-error'); }, submitHandler: function(form){ form.submit(); }}); }, showSellerForm: function(){ var value=$(this).val(); if(value==='seller'){ $('.show_if_seller').find('input, select').removeAttr('disabled'); $('.show_if_seller').slideDown(); if($('.tc_check_box').length > 0){ $('button[name=register]').attr('disabled','disabled'); }}else{ $('.show_if_seller').find('input, select').attr('disabled', 'disabled'); $('.show_if_seller').slideUp(); if($('.tc_check_box').length > 0){ $('button[name=register]').removeAttr('disabled'); }} }, onTOC: function(){ var chk_value=$(this).val(); if($(this).prop("checked")){ $('input[name=register]').removeAttr('disabled'); $('button[name=register]').removeAttr('disabled'); $('input[name=dokan_migration]').removeAttr('disabled'); }else{ $('input[name=register]').attr('disabled', 'disabled'); $('button[name=register]').attr('disabled', 'disabled'); $('input[name=dokan_migration]').attr('disabled', 'disabled'); }}, ensurePhoneNumber: function(e){ if($.inArray(e.keyCode, [46, 8, 9, 27, 13, 91, 107, 109, 110, 187, 189, 190])!==-1 || (e.keyCode==65&&e.ctrlKey===true) || (e.keyCode >=35&&e.keyCode <=39)){ return; } if((e.shiftKey||(e.keyCode < 48||e.keyCode > 57))&&(e.keyCode < 96||e.keyCode > 105)){ e.preventDefault(); }}, generateSlugFromCompany: function(){ var value=getSlug($(this).val()); $('#seller-url').val(value); $('#url-alart').text(value); $('#seller-url').focus(); }, constrainSlug: function(e){ var text=$(this).val(); if($.inArray(e.keyCode, [46, 8, 9, 27, 13, 91, 109, 110, 173, 189, 190])!==-1 || (e.keyCode==65&&e.ctrlKey===true) || (e.keyCode >=35&&e.keyCode <=39)){ return; } if((e.shiftKey||(e.keyCode < 65||e.keyCode > 90)&&(e.keyCode < 48||e.keyCode > 57))&&(e.keyCode < 96||e.keyCode > 105)){ e.preventDefault(); }}, checkSlugAvailability: function(){ var self=$(this), data={ action:'shop_url', url_slug:self.val(), _nonce:dokan.nonce, }; if(self.val()===''){ return; } var row=self.closest('.form-row'); row.block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); $.post(dokan.ajaxurl, data, function(resp){ if(resp.success===true){ $('#url-alart').removeClass('text-danger').addClass('text-success'); $('#url-alart-mgs').removeClass('text-danger').addClass('text-success').text(dokan.seller.available); }else{ $('#url-alart').removeClass('text-success').addClass('text-danger'); $('#url-alart-mgs').removeClass('text-success').addClass('text-danger').text(dokan.seller.notAvailable); } row.unblock(); }); }, renderUrl: function(){ $('#url-alart').text($(this).val()); }, validationLocalized: function(){ var dokan_messages=DokanValidateMsg; dokan_messages.maxlength=$.validator.format(dokan_messages.maxlength_msg); dokan_messages.minlength=$.validator.format(dokan_messages.minlength_msg); dokan_messages.rangelength=$.validator.format(dokan_messages.rangelength_msg); dokan_messages.range=$.validator.format(dokan_messages.range_msg); dokan_messages.max=$.validator.format(dokan_messages.max_msg); dokan_messages.min=$.validator.format(dokan_messages.min_msg); $.validator.messages=dokan_messages; }}; $(function(){ Dokan_Vendor_Registration.init(); $('.show_if_seller').find('input, select').attr('disabled', 'disabled'); var shouldTrigger=$('.woocommerce ul').hasClass('woocommerce-error')&&! $('.show_if_seller').is(':hidden'); if(shouldTrigger){ var form=$('form.register'); $('.user-role input[type=radio]', form).trigger('change'); } if($('.tc_check_box').length > 0){ $('input[name=dokan_migration]').attr('disabled', 'disabled'); $('input[name=register]').attr('disabled', 'disabled'); }}); })(jQuery); !function(Se){var ze=Math.abs,ke=Math.max,Ce=Math.min,Ae=Math.round;function We(){return Se("
")}Se.imgAreaSelect=function(o,n){var t,i,r,c,d,a,s,u,l,h,f,m,e,p,y,g,v,b,x,w,S,z,k,C,A,W,I,K,P,N=Se(o),H=We(),M=We(),E=We().add(We()).add(We()).add(We()),O=We().add(We()).add(We()).add(We()),T=Se([]),L={left:0,top:0},j={left:0,top:0},D=0,R="absolute",X={x1:0,y1:0,x2:0,y2:0,width:0,height:0},Y=document.documentElement,$=navigator.userAgent;function q(e){return e+L.left-j.left}function B(e){return e+L.top-j.top}function Q(e){return e-L.left+j.left}function F(e){return e-L.top+j.top}function G(e){return ke(e.pageX||0,U(e).x)-j.left}function J(e){return ke(e.pageY||0,U(e).y)-j.top}function U(e){var t=e.originalEvent||{};return t.touches&&t.touches.length?{x:t.touches[0].pageX,y:t.touches[0].pageY}:{x:0,y:0}}function V(e){var t=e||h,o=e||f;return{x1:Ae(X.x1*t),y1:Ae(X.y1*o),x2:Ae(X.x2*t),y2:Ae(X.y2*o),width:Ae(X.x2*t)-Ae(X.x1*t),height:Ae(X.y2*o)-Ae(X.y1*o)}}function Z(e,t,o,i,s){var n=s||h,r=s||f;(X={x1:Ae(e/n||0),y1:Ae(t/r||0),x2:Ae(o/n||0),y2:Ae(i/r||0)}).width=X.x2-X.x1,X.height=X.y2-X.y1}function _(){t&&N.width()&&(L={left:Ae(N.offset().left),top:Ae(N.offset().top)},d=N.innerWidth(),a=N.innerHeight(),L.top+=N.outerHeight()-a>>1,L.left+=N.outerWidth()-d>>1,e=Ae(n.minWidth/h)||0,p=Ae(n.minHeight/f)||0,y=Ae(Ce(n.maxWidth/h||1<<24,d)),g=Ae(Ce(n.maxHeight/f||1<<24,a)),"1.3.2"!=Se().jquery||"fixed"!=R||Y.getBoundingClientRect||(L.top+=ke(document.body.scrollTop,Y.scrollTop),L.left+=ke(document.body.scrollLeft,Y.scrollLeft)),j=/absolute|relative/.test(s.css("position"))?{left:Ae(s.offset().left)-s.scrollLeft(),top:Ae(s.offset().top)-s.scrollTop()}:"fixed"==R?{left:Se(document).scrollLeft(),top:Se(document).scrollTop()}:{left:0,top:0},r=q(0),c=B(0),(X.x2>d||X.y2>a)&&ce())}function ee(e){if(b){switch(H.css({left:q(X.x1),top:B(X.y1)}).add(M).width(I=X.width).height(K=X.height),M.add(E).add(T).css({left:0,top:0}),E.width(ke(I-E.outerWidth()+E.innerWidth(),0)).height(ke(K-E.outerHeight()+E.innerHeight(),0)),Se(O[0]).css({left:r,top:c,width:X.x1,height:a}),Se(O[1]).css({left:r+X.x1,top:c,width:I,height:X.y1}),Se(O[2]).css({left:r+X.x2,top:c,width:d-X.x2,height:a}),Se(O[3]).css({left:r+X.x1,top:c+X.y2,width:I,height:a-X.y2}),I-=T.outerWidth(),K-=T.outerHeight(),T.length){case 8:Se(T[4]).css({left:I>>1}),Se(T[5]).css({left:I,top:K>>1}),Se(T[6]).css({left:I>>1,top:K}),Se(T[7]).css({top:K>>1});case 4:T.slice(1,3).css({left:I}),T.slice(2,4).css({top:K})}!1!==e&&(Se.imgAreaSelect.onKeyPress!=ye&&Se(document).unbind(Se.imgAreaSelect.keyPress,Se.imgAreaSelect.onKeyPress),n.keys&&Se(document)[Se.imgAreaSelect.keyPress](Se.imgAreaSelect.onKeyPress=ye)),be&&E.outerWidth()-E.innerWidth()==2&&(E.css("margin",0),setTimeout(function(){E.css("margin","auto")},0))}}function te(e){_(),ee(e),x=q(X.x1),w=B(X.y1),S=q(X.x2),z=B(X.y2)}function oe(e,t){n.fadeSpeed?e.fadeOut(n.fadeSpeed,t):e.hide()}function ie(e){var t=Q(G(e))-X.x1,o=F(J(e))-X.y1;P||(_(),P=!0,H.one("mouseout",function(){P=!1})),m="",n.resizable&&(o<=n.resizeMargin?m="n":o>=X.height-n.resizeMargin&&(m="s"),t<=n.resizeMargin?m+="w":t>=X.width-n.resizeMargin&&(m+="e")),H.css("cursor",m?m+"-resize":n.movable?"move":""),i&&i.toggle()}function se(e){Se("body").css("cursor",""),!n.autoHide&&X.width*X.height!=0||oe(H.add(O),function(){Se(this).hide()}),Se(document).off("mousemove touchmove",de),H.on("mousemove touchmove",ie),n.onSelectEnd(o,V())}function ne(e){return"mousedown"==e.type&&1!=e.which||(ie(e),_(),m?(Se("body").css("cursor",m+"-resize"),x=q(X[/w/.test(m)?"x2":"x1"]),w=B(X[/n/.test(m)?"y2":"y1"]),Se(document).on("mousemove touchmove",de).one("mouseup touchend",se),H.off("mousemove touchmove",ie)):n.movable?(u=r+X.x1-G(e),l=c+X.y1-J(e),H.off("mousemove touchmove",ie),Se(document).on("mousemove touchmove",ue).one("mouseup touchend",function(){n.onSelectEnd(o,V()),Se(document).off("mousemove touchmove",ue),H.on("mousemove touchmove",ie)})):N.mousedown(e)),!1}function re(e){v&&(e?(S=ke(r,Ce(r+d,x+ze(z-w)*v*(xy&&(S=x-y*(Sg&&(z=w-g*(z":">",'"':""","'":"'","`":"`"},R=v.invert(T);v.escape=B(T),v.unescape=B(R),v.result=function(n,t,r){var e=null==n?void 0:n[t];return void 0===e&&(e=r),v.isFunction(e)?e.call(n):e};var q=0;v.uniqueId=function(n){var t=++q+"";return n?n+t:t},v.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function K(n){return"\\"+D[n]}var z=/(.)^/,D={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\u2028|\u2029/g;v.template=function(i,n,t){!n&&t&&(n=t),n=v.defaults({},n,v.templateSettings);var r=RegExp([(n.escape||z).source,(n.interpolate||z).source,(n.evaluate||z).source].join("|")+"|$","g"),o=0,a="__p+='";i.replace(r,function(n,t,r,e,u){return a+=i.slice(o,u).replace(L,K),o=u+n.length,t?a+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?a+="'+\n((__t=("+r+"))==null?'':__t)+\n'":e&&(a+="';\n"+e+"\n__p+='"),n}),a+="';\n",n.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{var e=new Function(n.variable||"obj","_",a)}catch(n){throw n.source=a,n}function u(n){return e.call(this,n,v)}var c=n.variable||"obj";return u.source="function("+c+"){\n"+a+"}",u},v.chain=function(n){var t=v(n);return t._chain=!0,t};function P(n,t){return n._chain?v(t).chain():t}v.mixin=function(r){v.each(v.functions(r),function(n){var t=v[n]=r[n];v.prototype[n]=function(){var n=[this._wrapped];return i.apply(n,arguments),P(this,t.apply(v,n))}})},v.mixin(v),v.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=e[t];v.prototype[t]=function(){var n=this._wrapped;return r.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],P(this,n)}}),v.each(["concat","join","slice"],function(n){var t=e[n];v.prototype[n]=function(){return P(this,t.apply(this._wrapped,arguments))}}),v.prototype.value=function(){return this._wrapped},v.prototype.valueOf=v.prototype.toJSON=v.prototype.value,v.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return v})}).call(this); window.wp=window.wp||{},function(t,o){var s,i,h={},r=Array.prototype.slice;s=function(){},i=function(t,e,n){var i;return i=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return t.apply(this,arguments)},o.extend(i,t),s.prototype=t.prototype,i.prototype=new s,e&&o.extend(i.prototype,e),n&&o.extend(i,n),(i.prototype.constructor=i).__super__=t.prototype,i},h.Class=function(t,e,n){var i,s=arguments;return t&&e&&h.Class.applicator===t&&(s=e,o.extend(this,n||{})),(i=this).instance&&(i=function(){return i.instance.apply(i,arguments)},o.extend(i,this)),i.initialize.apply(i,s),i},h.Class.extend=function(t,e){var n=i(this,t,e);return n.extend=this.extend,n},h.Class.applicator={},h.Class.prototype.initialize=function(){},h.Class.prototype.extended=function(t){for(var e=this;void 0!==e.constructor;){if(e.constructor===t)return!0;if(void 0===e.constructor.__super__)return!1;e=e.constructor.__super__}return!1},h.Events={trigger:function(t){return this.topics&&this.topics[t]&&this.topics[t].fireWith(this,r.call(arguments,1)),this},bind:function(t){return this.topics=this.topics||{},this.topics[t]=this.topics[t]||o.Callbacks(),this.topics[t].add.apply(this.topics[t],r.call(arguments,1)),this},unbind:function(t){return this.topics&&this.topics[t]&&this.topics[t].remove.apply(this.topics[t],r.call(arguments,1)),this}},h.Value=h.Class.extend({initialize:function(t,e){this._value=t,this.callbacks=o.Callbacks(),this._dirty=!1,o.extend(this,e||{}),this.set=o.proxy(this.set,this)},instance:function(){return arguments.length?this.set.apply(this,arguments):this.get()},get:function(){return this._value},set:function(t){var e=this._value;return t=this._setter.apply(this,arguments),null===(t=this.validate(t))||_.isEqual(e,t)||(this._value=t,this._dirty=!0,this.callbacks.fireWith(this,[t,e])),this},_setter:function(t){return t},setter:function(t){var e=this.get();return this._setter=t,this._value=null,this.set(e),this},resetSetter:function(){return this._setter=this.constructor.prototype._setter,this.set(this.get()),this},validate:function(t){return t},bind:function(){return this.callbacks.add.apply(this.callbacks,arguments),this},unbind:function(){return this.callbacks.remove.apply(this.callbacks,arguments),this},link:function(){var t=this.set;return o.each(arguments,function(){this.bind(t)}),this},unlink:function(){var t=this.set;return o.each(arguments,function(){this.unbind(t)}),this},sync:function(){var t=this;return o.each(arguments,function(){t.link(this),this.link(t)}),this},unsync:function(){var t=this;return o.each(arguments,function(){t.unlink(this),this.unlink(t)}),this}}),h.Values=h.Class.extend({defaultConstructor:h.Value,initialize:function(t){o.extend(this,t||{}),this._value={},this._deferreds={}},instance:function(t){return 1===arguments.length?this.value(t):this.when.apply(this,arguments)},value:function(t){return this._value[t]},has:function(t){return void 0!==this._value[t]},add:function(t,e){var n,i,s=this;if("string"==typeof t)n=t,i=e;else{if("string"!=typeof t.id)throw new Error("Unknown key");n=t.id,i=t}return s.has(n)?s.value(n):((s._value[n]=i).parent=s,i.extended(h.Value)&&i.bind(s._change),s.trigger("add",i),s._deferreds[n]&&s._deferreds[n].resolve(),s._value[n])},create:function(t){return this.add(t,new this.defaultConstructor(h.Class.applicator,r.call(arguments,1)))},each:function(n,i){i=void 0===i?this:i,o.each(this._value,function(t,e){n.call(i,e,t)})},remove:function(t){var e=this.value(t);e&&(this.trigger("remove",e),e.extended(h.Value)&&e.unbind(this._change),delete e.parent),delete this._value[t],delete this._deferreds[t],e&&this.trigger("removed",e)},when:function(){var e=this,n=r.call(arguments),i=o.Deferred();return o.isFunction(n[n.length-1])&&i.done(n.pop()),o.when.apply(o,o.map(n,function(t){if(!e.has(t))return e._deferreds[t]=e._deferreds[t]||o.Deferred()})).done(function(){var t=o.map(n,function(t){return e(t)});t.length===n.length?i.resolveWith(e,t):e.when.apply(e,n).done(function(){i.resolveWith(e,t)})}),i.promise()},_change:function(){this.parent.trigger("change",this)}}),o.extend(h.Values.prototype,h.Events),h.ensure=function(t){return"string"==typeof t?o(t):t},h.Element=h.Value.extend({initialize:function(t,e){var n,i,s,r=this,a=h.Element.synchronizer.html;this.element=h.ensure(t),this.events="",this.element.is("input, select, textarea")&&(n=this.element.prop("type"),this.events+=" change input",a=h.Element.synchronizer.val,this.element.is("input")&&h.Element.synchronizer[n]&&(a=h.Element.synchronizer[n])),h.Value.prototype.initialize.call(this,null,o.extend(e||{},a)),this._value=this.get(),i=this.update,s=this.refresh,this.update=function(t){t!==s.call(r)&&i.apply(this,arguments)},this.refresh=function(){r.set(s.call(r))},this.bind(this.update),this.element.bind(this.events,this.refresh)},find:function(t){return o(t,this.element)},refresh:function(){},update:function(){}}),h.Element.synchronizer={},o.each(["html","val"],function(t,e){h.Element.synchronizer[e]={update:function(t){this.element[e](t)},refresh:function(){return this.element[e]()}}}),h.Element.synchronizer.checkbox={update:function(t){this.element.prop("checked",t)},refresh:function(){return this.element.prop("checked")}},h.Element.synchronizer.radio={update:function(t){this.element.filter(function(){return this.value===t}).prop("checked",!0)},refresh:function(){return this.element.filter(":checked").val()}},o.support.postMessage=!!window.postMessage,h.Messenger=h.Class.extend({add:function(t,e,n){return this[t]=new h.Value(e,n)},initialize:function(t,e){var n=window.parent===window?null:window.parent;o.extend(this,e||{}),this.add("channel",t.channel),this.add("url",t.url||""),this.add("origin",this.url()).link(this.url).setter(function(t){var e=document.createElement("a");return e.href=t,e.protocol+"//"+e.host.replace(/:(80|443)$/,"")}),this.add("targetWindow",null),this.targetWindow.set=function(t){var e=this._value;return t=this._setter.apply(this,arguments),null===(t=this.validate(t))||e===t||(this._value=t,this._dirty=!0,this.callbacks.fireWith(this,[t,e])),this},this.targetWindow(t.targetWindow||n),this.receive=o.proxy(this.receive,this),this.receive.guid=o.guid++,o(window).on("message",this.receive)},destroy:function(){o(window).off("message",this.receive)},receive:function(t){var e;t=t.originalEvent,this.targetWindow&&this.targetWindow()&&(this.origin()&&t.origin!==this.origin()||"string"==typeof t.data&&"{"===t.data[0]&&(e=JSON.parse(t.data))&&e.id&&void 0!==e.data&&((e.channel||this.channel())&&this.channel()!==e.channel||this.trigger(e.id,e.data)))},send:function(t,e){var n;e=void 0===e?null:e,this.url()&&this.targetWindow()&&(n={id:t,data:e},this.channel()&&(n.channel=this.channel()),this.targetWindow().postMessage(JSON.stringify(n),this.origin()))}}),o.extend(h.Messenger.prototype,h.Events),h.Notification=h.Class.extend({template:null,templateId:"customize-notification",containerClasses:"",initialize:function(t,e){var n;this.code=t,delete(n=_.extend({message:null,type:"error",fromServer:!1,data:null,setting:null,template:null,dismissible:!1,containerClasses:""},e)).code,_.extend(this,n)},render:function(){var e,t,n=this;return n.template||(n.template=wp.template(n.templateId)),t=_.extend({},n,{alt:n.parent&&n.parent.alt}),e=o(n.template(t)),n.dismissible&&e.find(".notice-dismiss").on("click keydown",function(t){"keydown"===t.type&&13!==t.which||(n.parent?n.parent.remove(n.code):e.remove())}),e}}),(h=o.extend(new h.Values,h)).get=function(){var n={};return this.each(function(t,e){n[e]=t.get()}),n},h.utils={},h.utils.parseQueryString=function(t){var s={};return _.each(t.split("&"),function(t){var e,n,i;(e=t.split("=",2))[0]&&(n=(n=decodeURIComponent(e[0].replace(/\+/g," "))).replace(/ /g,"_"),i=_.isUndefined(e[1])?null:decodeURIComponent(e[1].replace(/\+/g," ")),s[n]=i)}),s},t.customize=h}(wp,jQuery); !function(n){var s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(t,e,i){s.Backbone=n(s,i,t,e)});else if("undefined"!=typeof exports){var t,e=require("underscore");try{t=require("jquery")}catch(t){}n(s,exports,e,t)}else s.Backbone=n(s,{},s._,s.jQuery||s.Zepto||s.ender||s.$)}(function(t,h,x,e){var i=t.Backbone,o=Array.prototype.slice;h.VERSION="1.4.0",h.$=e,h.noConflict=function(){return t.Backbone=i,this},h.emulateHTTP=!1,h.emulateJSON=!1;var a,n=h.Events={},u=/\s+/,l=function(t,e,i,n,s){var r,o=0;if(i&&"object"==typeof i){void 0!==n&&"context"in s&&void 0===s.context&&(s.context=n);for(r=x.keys(i);othis.length&&(n=this.length),n<0&&(n+=this.length+1);var s,r,o=[],a=[],h=[],u=[],l={},c=e.add,d=e.merge,f=e.remove,p=!1,g=this.comparator&&null==n&&!1!==e.sort,v=x.isString(this.comparator)?this.comparator:null;for(r=0;r 0){ this.addRandomChoice(current); }}, maybeRemoveOldCrop: function(model){ var newID=model.get('header').attachment_id||false, oldCrop; if(! newID){ return; } oldCrop=this.find(function(item){ return(item.cid!==model.cid&&item.get('header').attachment_id===newID); }); if(oldCrop){ this.remove(oldCrop); }}, maybeAddRandomChoice: function(){ if(this.size()===1){ this.addRandomChoice(); }}, addRandomChoice: function(initialChoice){ var isRandomSameType=RegExp(this.type).test(initialChoice), randomChoice='random-' + this.type + '-image'; this.add({ header: { timestamp: 0, random: randomChoice, width: 245, height: 41 }, choice: randomChoice, random: true, selected: isRandomSameType }); }, isRandomChoice: function(choice){ return (/^random-(uploaded|default)-image$/).test(choice); }, shouldHideTitle: function(){ return this.size() < 2; }, setImage: function(model){ this.each(function(m){ m.set('selected', false); }); if(model){ model.set('selected', true); }}, removeImage: function(){ this.each(function(m){ m.set('selected', false); }); }}); api.HeaderTool.DefaultsList=api.HeaderTool.ChoiceList.extend({ initialize: function(){ this.type='default'; this.data=_wpCustomizeHeader.defaults; api.HeaderTool.ChoiceList.prototype.initialize.apply(this); }}); })(jQuery, window.wp); jQuery(function($){ $('.tips').tooltip(); $('ul.order-status').on('click', 'a.dokan-edit-status', function(e){ $(this).addClass('dokan-hide').closest('li').next('li').removeClass('dokan-hide'); return false; }); $('ul.order-status').on('click', 'a.dokan-cancel-status', function(e){ $(this).closest('li').addClass('dokan-hide').prev('li').find('a.dokan-edit-status').removeClass('dokan-hide'); return false; }); $('form#dokan-order-status-form').on('submit', function(e){ e.preventDefault(); var self=$(this), li=self.closest('li'); li.block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); $.post(dokan.ajaxurl, self.serialize(), function(response){ li.unblock(); if(response.success){ var prev_li=li.prev(); li.addClass('dokan-hide'); prev_li.find('label').replaceWith(response.data); prev_li.find('a.dokan-edit-status').removeClass('dokan-hide'); }else{ alert(response.data); }}); }); $('form#add-order-note').on('submit', function(e){ e.preventDefault(); if(!$('textarea#add-note-content').val()) return; $('#dokan-order-notes').block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); $.post(dokan.ajaxurl, $(this).serialize(), function(response){ $('ul.order_notes').prepend(response); $('#dokan-order-notes').unblock(); $('#add-note-content').val(''); }); return false; }) $('#dokan-order-notes').on('click', 'a.delete_note', function(){ var note=$(this).closest('li.note'); $('#dokan-order-notes').block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); var data={ action: 'dokan_delete_order_note', note_id: $(note).attr('rel'), security: $('#delete-note-security').val() }; $.post(dokan.ajaxurl, data, function(response){ $(note).remove(); $('#dokan-order-notes').unblock(); }); return false; }); $('.order_download_permissions').on('click', 'button.grant_access', function(){ var self=$(this), product=$('select.grant_access_id').val(); if(!product) return; $('.order_download_permissions').block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); var data={ action: 'dokan_grant_access_to_download', product_ids: product, loop: $('.order_download_permissions .panel').size(), order_id: self.data('order-id'), security: self.data('nonce') }; $.post(dokan.ajaxurl, data, function(response){ if(response){ $('#accordion').append(response); }else{ alert('Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.'); } $('.datepicker').datepicker(); $('.order_download_permissions').unblock(); }); return false; }); $('.order_download_permissions').on('click', 'button.revoke_access', function(e){ e.preventDefault(); var answer=confirm('Are you sure you want to revoke access to this download?'); if(answer){ var self=$(this), el=self.closest('.dokan-panel'); var product=self.attr('rel').split(",")[0]; var file=self.attr('rel').split(",")[1]; if(product > 0){ $(el).block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); var data={ action: 'dokan_revoke_access_to_download', product_id: product, download_id: file, order_id: self.data('order-id'), permission_id: self.data('permission-id'), security: self.data('nonce') }; $.post(dokan.ajaxurl, data, function(response){ $(el).fadeOut('300', function(){ $(el).remove(); }); }); }else{ $(el).fadeOut('300', function(){ $(el).remove(); }); }} return false; }); }); ;(function($){ var dokan_seller_meta_boxes_order_items={ init: function(){ let formatMap={ d: 'dd', D: 'D', j: 'd', l: 'DD', F: 'MM', m: 'mm', M: 'M', n: 'm', o: 'yy', Y: 'yy', y: 'y' } let i=0; let char=''; let datepickerFormat=''; for (i=0; i < dokan.i18n_date_format.length; i++){ char=dokan.i18n_date_format[i]; if(char in formatMap){ datepickerFormat +=formatMap[char]; }else{ datepickerFormat +=char; }} $("#shipped-date").datepicker({ dateFormat: datepickerFormat }); $('body').on('click','#dokan-add-tracking-number', this.showTrackingForm); $('body').on('click','#dokan-cancel-tracking-note', this.cancelTrackingForm); $('body').on('click','#add-tracking-details', this.insertShippingTrackingInfo); $('#woocommerce-order-items') .on('click', 'button.refund-items', this.refund_items) .on('click', '.cancel-action', this.cancel) .on('click', 'button.do-api-refund, button.do-manual-refund', this.refunds.do_refund) .on('change', '.refund input.refund_line_total, .refund input.refund_line_tax', this.refunds.input_changed) .on('change keyup', '.wc-order-refund-items #refund_amount', this.refunds.amount_changed) .on('change', 'input.refund_order_item_qty', this.refunds.refund_quantity_changed) .on('keyup', '.woocommerce_order_items .split-input input:eq(0)', function(){ var $subtotal=$(this).next(); if($subtotal.val()===''||$subtotal.is('.match-total')){ $subtotal.val($(this).val()).addClass('match-total'); }}) .on('keyup', '.woocommerce_order_items .split-input input:eq(1)', function(){ $(this).removeClass('match-total'); }) }, showTrackingForm: function(e){ e.preventDefault(); var self=$(this); self.closest('div').find('form#add-shipping-tracking-form').slideDown(300, function(){ $(this).removeClass('dokan-hide'); }); }, cancelTrackingForm: function(e){ e.preventDefault(); var self=$(this); self.closest('form#add-shipping-tracking-form').slideUp(300, function(){ $(this).addClass('dokan-hide'); }); }, insertShippingTrackingInfo: function(e){ e.preventDefault(); var shipping_tracking_info={ shipping_provider: $('#shipping_provider').val(), shipping_number: $('#tracking_number').val(), shipped_date: $('#shipped-date').val(), action: $('#action').val(), post_id: $('#post-id').val(), security: $('#security').val() }; $('#dokan-order-notes').block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); $.post(dokan.ajaxurl, shipping_tracking_info, function(response){ $('ul.order_notes').prepend(response); $('#dokan-order-notes').unblock(); $('form#add-shipping-tracking-form').find("input[type=text], textarea").val(""); }); return false; }, block: function(){ $('#woocommerce-order-items').block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 }}); }, unblock: function(){ $('#woocommerce-order-items').unblock(); }, reload_items: function(){ var data={ order_id: dokan_refund.post_id, action: 'dokan_load_order_items', security: dokan_refund.order_item_nonce }; dokan_seller_meta_boxes_order_items.block(); $.ajax({ url: dokan_refund.ajax_url, data: data, type: 'POST', success: function(response){ $('.dokan-panel-default #woocommerce-order-items').empty(); $('.dokan-panel-default #woocommerce-order-items').append(response); }}); }, refund_items: function(){ $('div.wc-order-refund-items').slideDown(); $('div.wc-order-bulk-actions').slideUp(); $('div.wc-order-totals-items').slideUp(); $('#woocommerce-order-items div.refund').show(); $('.wc-order-edit-line-item .wc-order-edit-line-item-actions').hide(); return false; }, cancel: function(){ $(this).closest('div.wc-order-data-row').slideUp(); $('div.wc-order-bulk-actions').slideDown(); $('div.wc-order-totals-items').slideDown(); $('#woocommerce-order-items div.refund').hide(); $('.wc-order-edit-line-item .wc-order-edit-line-item-actions').show(); if('true'===$(this).attr('data-reload')){ dokan_seller_meta_boxes_order_items.reload_items(); } return false; }, refunds: { do_refund: function(){ dokan_seller_meta_boxes_order_items.block(); if(window.confirm(dokan_refund.i18n_do_refund)){ var refund_amount=$('input#refund_amount').val(); var refund_reason=$('input#refund_reason').val(); var line_item_qtys={}; var line_item_totals={}; var line_item_tax_totals={}; $('.refund input.refund_order_item_qty').each(function(index, item){ if($(item).closest('tr').data('order_item_id')){ if(item.value){ line_item_qtys[ $(item).closest('tr').data('order_item_id') ]=item.value; }} }); $('.refund input.refund_line_total').each(function(index, item){ if($(item).closest('tr').data('order_item_id')){ line_item_totals[ $(item).closest('tr').data('order_item_id') ]=accounting.unformat(item.value, dokan_refund.mon_decimal_point); }}); $('.refund input.refund_line_tax').each(function(index, item){ if($(item).closest('tr').data('order_item_id')){ var tax_id=$(item).data('tax_id'); if(! line_item_tax_totals[ $(item).closest('tr').data('order_item_id') ]){ line_item_tax_totals[ $(item).closest('tr').data('order_item_id') ]={};} line_item_tax_totals[ $(item).closest('tr').data('order_item_id') ][ tax_id ]=accounting.unformat(item.value, dokan_refund.mon_decimal_point); }}); var data={ action: 'dokan_refund_request', order_id: dokan_refund.post_id, refund_amount: refund_amount, refund_reason: refund_reason, line_item_qtys: JSON.stringify(line_item_qtys, null, ''), line_item_totals: JSON.stringify(line_item_totals, null, ''), line_item_tax_totals: JSON.stringify(line_item_tax_totals, null, ''), api_refund: $(this).is('.do-api-refund'), restock_refunded_items: $('#restock_refunded_items:checked').size() ? 'true':'false', security: dokan_refund.order_item_nonce }; $.post(dokan_refund.ajax_url, data, function(response){ response.data.message ? window.alert(response.data.message):null; dokan_seller_meta_boxes_order_items.reload_items(); }).fail(function(jqXHR){ var message=[]; if(jqXHR.responseJSON.data){ var data=jqXHR.responseJSON.data; if($.isArray(data)){ message=jqXHR.responseJSON.data.map(function(item){ return item.message; }); }else{ message.push(data); }} window.alert(message.join(' ')); dokan_seller_meta_boxes_order_items.unblock(); }); }else{ dokan_seller_meta_boxes_order_items.unblock(); }}, input_changed: function(){ var refund_amount=0; var $items=$('.woocommerce_order_items').find('tr.item, tr.fee, tr.shipping'); $items.each(function(){ var $row=$(this); var refund_cost_fields=$row.find('.refund input:not(.refund_order_item_qty)'); refund_cost_fields.each(function(index, el){ refund_amount +=parseFloat(accounting.unformat($(el).val()||0, dokan_refund.mon_decimal_point)); }); }); $('#refund_amount') .val(accounting.formatNumber(refund_amount, dokan_refund.currency_format_num_decimals, '', dokan_refund.mon_decimal_point )) .change(); }, amount_changed: function(){ var total=accounting.unformat($(this).val(), dokan_refund.mon_decimal_point); $('button .wc-order-refund-amount .amount').text(accounting.formatMoney(total, { symbol: dokan_refund.currency_format_symbol, decimal: dokan_refund.currency_format_decimal_sep, thousand: dokan_refund.currency_format_thousand_sep, precision: dokan_refund.currency_format_num_decimals, format: dokan_refund.currency_format })); }, refund_quantity_changed: function(){ var $row=$(this).closest('tr.item'); var qty=$row.find('input.quantity').val(); var refund_qty=$(this).val(); var line_total=$('input.line_total', $row); var refund_line_total=$('input.refund_line_total', $row); var unit_total=accounting.unformat(line_total.attr('data-total'), dokan_refund.mon_decimal_point) / qty; refund_line_total.val(parseFloat(accounting.formatNumber(unit_total * refund_qty, dokan_refund.rounding_precision, '')) .toString() .replace('.', dokan_refund.mon_decimal_point) ).change(); $('td.line_tax', $row).each(function(){ var line_total_tax=$('input.line_tax', $(this)); var refund_line_total_tax=$('input.refund_line_tax', $(this)); var unit_total_tax=accounting.unformat(line_total_tax.attr('data-total_tax'), dokan_refund.mon_decimal_point) / qty; if(0 < unit_total_tax){ refund_line_total_tax.val(parseFloat(accounting.formatNumber(unit_total_tax * refund_qty, dokan_refund.rounding_precision, '')) .toString() .replace('.', dokan_refund.mon_decimal_point) ).change(); }else{ refund_line_total_tax.val(0).change(); }}); if(refund_qty > 0){ $('#restock_refunded_items').closest('tr').show(); }else{ $('#restock_refunded_items').closest('tr').hide(); $('.woocommerce_order_items input.refund_order_item_qty').each(function(){ if($(this).val() > 0){ $('#restock_refunded_items').closest('tr').show(); }}); } $(this).trigger('refund_quantity_changed'); }}, }; dokan_seller_meta_boxes_order_items.init(); $('#dokan-filter-customer').filter(':not(.enhanced)').each(function(){ var select2_args={ allowClear: $(this).data('allow_clear') ? true:false, placeholder: $(this).data('placeholder'), minimumInputLength: $(this).data('minimum_input_length') ? $(this).data('minimum_input_length'):'1', escapeMarkup: function(m){ return m; }, ajax: { url: dokan.ajaxurl, dataType: 'json', delay: 1000, data: function(params){ return { term: params.term, action: 'dokan_json_search_vendor_customers', security: dokan.search_customer_nonce, exclude: $(this).data('exclude') };}, processResults: function(data){ var terms=[]; if(data){ $.each(data, function(id, text){ terms.push({ id: id, text: text }); }); } return { results: terms };}, cache: true }}; $(this).select2(select2_args).addClass('enhanced'); if($(this).data('sortable')){ var $select=$(this); var $list=$(this).next('.select2-container').find('ul.select2-selection__rendered'); $list.sortable({ placeholder:'ui-state-highlight select2-selection__choice', forcePlaceholderSize: true, items:'li:not(.select2-search__field)', tolerance:'pointer', stop: function(){ $($list.find('.select2-selection__choice').get().reverse()).each(function(){ var id=$(this).data('data').id; var option=$select.find('option[value="' + id + '"]')[0]; $select.prepend(option); }); }}); }}); })(jQuery); ;(function($){ var variantsHolder=$('#variants-holder'); var product_gallery_frame; var product_featured_frame; var $image_gallery_ids=$('#product_image_gallery'); var $product_images=$('#product_images_container ul.product_images'); var Dokan_Editor={ init: function(){ product_type='simple'; $('.product-edit-container').on('click', '.dokan-section-heading', this.toggleProductSection); $('.product-edit-container').on('click', 'input[type=checkbox]#_downloadable', this.downloadable); $('.product-edit-container').on('click', 'a.sale-schedule', this.showDiscountSchedule); $('body, #dokan-product-images').on('click', 'a.add-product-images', this.gallery.addImages); $('body, #dokan-product-images').on('click', 'a.action-delete', this.gallery.deleteImage); this.gallery.sortable(); $('body, .product-edit-container').on('click', 'a.dokan-feat-image-btn', this.featuredImage.addImage); $('body, .product-edit-container').on('click', 'a.dokan-remove-feat-image', this.featuredImage.removeImage); $('body, #variable_product_options').on('click', '.sale_schedule', this.saleSchedule); $('body, #variable_product_options').on('click', '.cancel_sale_schedule', this.cancelSchedule); $('.product-edit-container').on('change', 'input[type=checkbox]#_manage_stock', this.showManageStock); $('.product-edit-container').on('click', 'a.upload_file_button', this.fileDownloadable); $('body').on('click', 'a.insert-file-row', function(){ $(this).closest('table').find('tbody').append($(this).data('row')); return false; }); $('body').on('click', 'a.dokan-product-delete', function(){ $(this).closest('tr').remove(); return false; }); $('body').on('submit', 'form.dokan-product-edit-form', this.inputValidate); $('.dokan-product-listing').on('click', 'a.dokan-add-new-product', this.addProductPopup); this.loadSelect2(); this.bindProductTagDropdown(); this.attribute.sortable(); this.checkProductPostboxToggle(); $('.product-edit-container .dokan-product-attribute-wrapper').on('click', 'a.dokan-product-toggle-attribute, .dokan-product-attribute-heading', this.attribute.toggleAttribute); $('.product-edit-container .dokan-product-attribute-wrapper').on('click', 'a.add_new_attribute', this.attribute.addNewAttribute); $('.product-edit-container .dokan-product-attribute-wrapper').on('keyup', 'input.dokan-product-attribute-name', this.attribute.dynamicAttrNameChange); $('.dokan-product-attribute-wrapper ul.dokan-attribute-option-list').on('click', 'button.dokan-select-all-attributes', this.attribute.selectAllAttr); $('.dokan-product-attribute-wrapper ul.dokan-attribute-option-list').on('click', 'button.dokan-select-no-attributes', this.attribute.selectNoneAttr); $('.dokan-product-attribute-wrapper ul.dokan-attribute-option-list').on('click', 'button.dokan-add-new-attribute', this.attribute.addNewExtraAttr); $('.product-edit-container .dokan-product-attribute-wrapper').on('click', 'a.dokan-product-remove-attribute', this.attribute.removeAttribute); $('.product-edit-container .dokan-product-attribute-wrapper').on('click', 'a.dokan-save-attribute', this.attribute.saveAttribute); $('body').on('click', '.product-container-footer input[type="submit"]', this.createNewProduct); this.attribute.disbalePredefinedAttribute(); $('body').trigger('dokan-product-editor-loaded', this); }, saleSchedule: function(){ var $wrap=$(this).closest('.dokan-product-field-content', 'div, table'); $(this).hide(); $wrap.find('.cancel_sale_schedule').show(); $wrap.find('.sale_price_dates_fields').show(); return false; }, cancelSchedule: function(){ var $wrap=$(this).closest('.dokan-product-field-content', 'div, table'); $(this).hide(); $wrap.find('.sale_schedule').show(); $wrap.find('.sale_price_dates_fields').hide(); $wrap.find('.sale_price_dates_fields').find('input').val(''); return false; }, checkProductPostboxToggle: function(){ var toggle=JSON.parse(localStorage.getItem('toggleClasses')); $.each(toggle, function(el, i){ var wrapper=$('.' + el.replace(/_/g, '-')), content=wrapper.find('.dokan-section-content'), targetIcon=wrapper.find('i.fa-sort-desc'); if(i){ content.show(); targetIcon.removeClass('fa-flip-horizointal').addClass('fa-flip-vertical'); targetIcon.css('marginTop', '9px'); }else{ content.hide(); targetIcon.removeClass('fa-flip-vertical').addClass('fa-flip-horizointal'); targetIcon.css('marginTop', '0px'); }}); }, toggleProductSection: function(e){ e.preventDefault(); var self=$(this); if(JSON.parse(localStorage.getItem('toggleClasses'))!=null){ var toggleClasses=JSON.parse(localStorage.getItem('toggleClasses')); }else{ var toggleClasses={};} self.closest('.dokan-edit-row').find('.dokan-section-content').slideToggle(300, function(){ if($(this).is(':visible')){ var targetIcon=self.find('i.fa-sort-desc'); targetIcon.removeClass('fa-flip-horizointal').addClass('fa-flip-vertical'); targetIcon.css('marginTop', '9px'); toggleClasses[self.data('togglehandler')]=true; }else{ var targetIcon=self.find('i.fa-sort-desc'); targetIcon.removeClass('fa-flip-vertical').addClass('fa-flip-horizointal'); targetIcon.css('marginTop', '0px'); toggleClasses[self.data('togglehandler')]=false; } localStorage.setItem('toggleClasses', JSON.stringify(toggleClasses)); }); }, loadSelect2: function(){ $('.dokan-select2').select2( { "language": { "noResults": function (){ return dokan.i18n_no_result_found; }} } ); }, bindProductTagDropdown: function (){ if(dokan.product_vendors_can_create_tags&&'on'===dokan.product_vendors_can_create_tags){ return; } $('#product_tag').select2({ language: { noResults: function (){ return dokan.i18n_no_result_found; }} }); }, addProductPopup: function (e){ e.preventDefault(); Dokan_Editor.openProductPopup(); }, openProductPopup: function(){ var productTemplate=wp.template('dokan-add-new-product'); $.magnificPopup.open({ fixedContentPos: true, items: { src: productTemplate().trim(), type: 'inline' }, callbacks: { open: function(){ $(this.content).closest('.mfp-wrap').removeAttr('tabindex'); Dokan_Editor.loadSelect2(); Dokan_Editor.bindProductTagDropdown(); $('.sale_price_dates_from, .sale_price_dates_to').on('focus', function(){ $(this).css('z-index', '99999'); }); $(".sale_price_dates_fields input").datepicker({ defaultDate: "", dateFormat: "yy-mm-dd", numberOfMonths: 1 }); $('.tips').tooltip(); Dokan_Editor.gallery.sortable(); $('body').trigger('dokan-product-editor-popup-opened', Dokan_Editor); }, close: function(){ product_gallery_frame=undefined; product_featured_frame=undefined; }} }); }, createNewProduct: function (e){ e.preventDefault(); var self=$(this), form=self.closest('form#dokan-add-new-product-form'), btn_id=self.attr('data-btn_id'); form.find('span.dokan-show-add-product-error').html(''); form.find('span.dokan-add-new-product-spinner').css('display', 'inline-block'); self.attr('disabled', 'disabled'); if(form.find('input[name="post_title"]').val()==''){ $('span.dokan-show-add-product-error').html(dokan.product_title_required); self.removeAttr('disabled'); form.find('span.dokan-add-new-product-spinner').css('display', 'none'); return; } if(form.find('select[name="product_cat"]').val()=='-1'){ $('span.dokan-show-add-product-error').html(dokan.product_category_required); self.removeAttr('disabled'); form.find('span.dokan-add-new-product-spinner').css('display', 'none'); return; } var data={ action: 'dokan_create_new_product', postdata: form.serialize(), _wpnonce:dokan.nonce }; $.post(dokan.ajaxurl, data, function(resp){ if(resp.success){ self.removeAttr('disabled'); if(btn_id=='create_new'){ $.magnificPopup.close(); window.location.href=resp.data; }else{ $('.dokan-dashboard-product-listing-wrapper').load(window.location.href + ' table.product-listing-table'); $.magnificPopup.close(); Dokan_Editor.openProductPopup(); }}else{ self.removeAttr('disabled'); $('span.dokan-show-add-product-error').html(resp.data); } form.find('span.dokan-add-new-product-spinner').css('display', 'none'); }); }, attribute: { toggleAttribute: function(e){ e.preventDefault(); var self=$(this), list=self.closest('li'), item=list.find('.dokan-product-attribute-item'); if($(item).hasClass('dokan-hide')){ self.closest('.dokan-product-attribute-heading').css({ borderBottom: '1px solid #e3e3e3' }); $(item).slideDown(200, function(){ self.find('i.fa').removeClass('fa-flip-horizointal').addClass('fa-flip-vertical'); $(this).removeClass('dokan-hide'); if(! $(e.target).hasClass('dokan-product-attribute-heading')){ $(e.target).closest('a').css('top', '12px'); }else if($(e.target).hasClass('dokan-product-attribute-heading')){ self.find('a.dokan-product-toggle-attribute').css('top', '12px'); }}); }else{ $(item).slideUp(200, function(){ $(this).addClass('dokan-hide'); self.find('i.fa').removeClass('fa-flip-vertical').addClass('fa-flip-horizointal'); if(! $(e.target).hasClass('dokan-product-attribute-heading')){ $(e.target).closest('a').css('top', '7px'); }else if($(e.target).hasClass('dokan-product-attribute-heading')){ self.find('a.dokan-product-toggle-attribute').css('top', '7px'); } self.closest('.dokan-product-attribute-heading').css({ borderBottom: 'none' }); }) } return false; }, sortable: function(){ $('.dokan-product-attribute-wrapper ul').sortable({ items: 'li.product-attribute-list', cursor: 'move', scrollSensitivity:40, forcePlaceholderSize: true, forceHelperSize: false, helper: 'clone', opacity: 0.65, placeholder: 'dokan-sortable-placeholder', start:function(event,ui){ ui.item.css('background-color','#f6f6f6'); }, stop:function(event,ui){ ui.item.removeAttr('style'); }, update: function(event, ui){ var attachment_ids=''; Dokan_Editor.attribute.reArrangeAttribute(); }}); }, dynamicAttrNameChange: function(e){ e.preventDefault(); var self=$(this), value=self.val(); if(value==''){ self.closest('li').find('strong').html('Attribute Name'); }else{ self.closest('li').find('strong').html(value); }}, selectAllAttr: function(e){ e.preventDefault(); $(this).closest('li.product-attribute-list').find('select.dokan_attribute_values option').attr('selected', 'selected'); $(this).closest('li.product-attribute-list').find('select.dokan_attribute_values').change(); return false; }, selectNoneAttr: function(e){ e.preventDefault(); $(this).closest('li.product-attribute-list').find('select.dokan_attribute_values option').removeAttr('selected'); $(this).closest('li.product-attribute-list').find('select.dokan_attribute_values').change(); return false; }, reArrangeAttribute: function(){ var attributeWrapper=$('.dokan-product-attribute-wrapper').find('ul.dokan-attribute-option-list'); attributeWrapper.find('li.product-attribute-list').css('cursor', 'default').each(function(i){ $(this).find('.attribute_position').val(i); }); }, addNewExtraAttr: function(e){ e.preventDefault(); var $wrapper=$(this).closest('li.product-attribute-list'); var attribute=$wrapper.data('taxonomy'); var new_attribute_name=window.prompt(dokan.new_attribute_prompt); if(new_attribute_name){ var data={ action: 'dokan_add_new_attribute', taxonomy: attribute, term: new_attribute_name, _wpnonce:dokan.nonce }; $.post(dokan.ajaxurl, data, function(response){ if(response.error){ window.alert(response.error); }else if(response.slug){ $wrapper.find('select.dokan_attribute_values').append(''); $wrapper.find('select.dokan_attribute_values').change(); }}); }}, addNewAttribute: function(e){ e.preventDefault(); var self=$(this), attrWrap=self.closest('.dokan-attribute-type').find('select#predefined_attribute'), attribute=attrWrap.val(), size=$('ul.dokan-attribute-option-list .product-attribute-list').length; var data={ action:'dokan_get_pre_attribute', taxonomy:attribute, i:size, _wpnonce:dokan.nonce }; self.closest('.dokan-attribute-type').find('span.dokan-attribute-spinner').removeClass('dokan-hide'); $.post(dokan.ajaxurl, data, function(resp){ if(resp.success){ var attributeWrapper=$('.dokan-product-attribute-wrapper').find('ul.dokan-attribute-option-list'); $html=$.parseHTML(resp.data); $($html).find('.dokan-product-attribute-item').removeClass('dokan-hide'); $($html).find('i.fa.fa-sort-desc').removeClass('fa-flip-horizointal').addClass('fa-flip-vertical'); $($html).find('a.dokan-product-toggle-attribute').css('top','12px'); $($html).find('.dokan-product-attribute-heading').css({ borderBottom: '1px solid #e3e3e3' }); attributeWrapper.append($html); $('select#product_type').trigger('change'); Dokan_Editor.loadSelect2(); Dokan_Editor.attribute.reArrangeAttribute(); }; self.closest('.dokan-attribute-type').find('span.dokan-attribute-spinner').addClass('dokan-hide'); if(attribute){ attrWrap.find('option[value="' + attribute + '"]').attr('disabled','disabled'); attrWrap.val(''); }}); }, removeAttribute: function(evt){ evt.stopPropagation(); if(window.confirm(dokan.remove_attribute)){ var $parent=$(this).closest('li.product-attribute-list'); $parent.fadeOut(300, function(){ if($parent.is('.taxonomy')){ $parent.find('select, input[type=text]').val(''); $('select.dokan_attribute_taxonomy').find('option[value="' + $parent.data('taxonomy') + '"]').removeAttr('disabled'); }else{ $parent.find('select, input[type=text]').val(''); $parent.hide(); } Dokan_Editor.attribute.reArrangeAttribute(); }); } return false; }, saveAttribute: function(e){ e.preventDefault(); var self=$(this), data={ post_id: $('#dokan-edit-product-id').val(), data: $('ul.dokan-attribute-option-list').find('input, select, textarea').serialize(), action: 'dokan_save_attributes' }; $('.dokan-product-attribute-wrapper').block({ message: null, fadeIn: 50, fadeOut: 1000, overlayCSS: { background: '#fff', opacity: 0.6 }}); $.post(dokan.ajaxurl, data, function(resp){ $('#dokan-variable-product-options').load(window.location.toString() + ' #dokan-variable-product-options-inner', function(){ $('#dokan-variable-product-options').trigger('reload'); $('select#product_type').trigger('change'); $('.dokan-product-attribute-wrapper').unblock(); }); }); }, disbalePredefinedAttribute: function(){ $('ul.dokan-attribute-option-list li.product-attribute-list').each(function(index, el){ if($(el).css('display')!=='none'&&$(el).is('.taxonomy')){ $('select#predefined_attribute').find('option[value="' + $(el).data('taxonomy') + '"]').attr('disabled', 'disabled'); }}); }}, inputValidate: function(e){ e.preventDefault(); if($('#post_title').val().trim()==''){ $('#post_title').focus(); $('div.dokan-product-title-alert').removeClass('dokan-hide'); return; }else{ $('div.dokan-product-title-alert').hide(); } if($('select.product_cat').val()==-1){ $('select.product_cat').focus(); $('div.dokan-product-cat-alert').removeClass('dokan-hide'); return; }else{ $('div.dokan-product-cat-alert').hide(); } $('input[type=submit]').attr('disabled', 'disabled'); this.submit(); }, downloadable: function(){ if($(this).prop('checked')){ $(this).closest('aside').find('.dokan-side-body').removeClass('dokan-hide'); }else{ $(this).closest('aside').find('.dokan-side-body').addClass('dokan-hide'); }}, showDiscountSchedule: function(e){ e.preventDefault(); $('.sale-schedule-container').slideToggle('fast'); }, showManageStock: function(e){ if($(this).is(':checked')){ $('.show_if_stock').slideDown('fast'); }else{ $('.show_if_stock').slideUp('fast'); }}, gallery: { addImages: function(e){ e.preventDefault(); var self=$(this), p_images=self.closest('.dokan-product-gallery').find('#product_images_container ul.product_images'), images_gid=self.closest('.dokan-product-gallery').find('#product_image_gallery'); if(product_gallery_frame){ product_gallery_frame.open(); return; }else{ product_gallery_frame=wp.media({ title: dokan.i18n_choose_gallery, button: { text: dokan.i18n_choose_gallery_btn_text, }, multiple: true }); product_gallery_frame.on('select', function(){ var selection=product_gallery_frame.state().get('selection'); selection.map(function(attachment){ attachment=attachment.toJSON(); if(attachment.id){ attachment_ids=[]; $('
  • \ \ ×\
  • ').insertBefore(p_images.find('li.add-image')); $('#product_images_container ul li.image').css('cursor','default').each(function(){ var attachment_id=jQuery(this).attr('data-attachment_id'); attachment_ids.push(attachment_id); }); }}); images_gid.val(attachment_ids.join(',')); }); product_gallery_frame.open(); }}, deleteImage: function(e){ e.preventDefault(); var self=$(this), p_images=self.closest('.dokan-product-gallery').find('#product_images_container ul.product_images'), images_gid=self.closest('.dokan-product-gallery').find('#product_image_gallery'); self.closest('li.image').remove(); var attachment_ids=[]; $('#product_images_container ul li.image').css('cursor','default').each(function(){ var attachment_id=$(this).attr('data-attachment_id'); attachment_ids.push(attachment_id); }); images_gid.val(attachment_ids.join(',')); return false; }, sortable: function(){ $('body').find('#product_images_container ul.product_images').sortable({ items: 'li.image', cursor: 'move', scrollSensitivity:40, forcePlaceholderSize: true, forceHelperSize: false, helper: 'clone', opacity: 0.65, placeholder: 'dokan-sortable-placeholder', start:function(event,ui){ ui.item.css('background-color','#f6f6f6'); }, stop:function(event,ui){ ui.item.removeAttr('style'); }, update: function(event, ui){ var attachment_ids=[]; $('body').find('#product_images_container ul li.image').css('cursor','default').each(function(){ var attachment_id=jQuery(this).attr('data-attachment_id'); attachment_ids.push(attachment_id); }); $('body').find('#product_image_gallery').val(attachment_ids.join(',')); }}); }}, featuredImage: { addImage: function(e){ e.preventDefault(); var self=$(this); if(product_featured_frame){ product_featured_frame.open(); return; }else{ product_featured_frame=wp.media({ title: dokan.i18n_choose_featured_img, button: { text: dokan.i18n_choose_featured_img_btn_text, }}); product_featured_frame.on('select', function(){ var selection=product_featured_frame.state().get('selection'); selection.map(function(attachment){ attachment=attachment.toJSON(); self.siblings('input.dokan-feat-image-id').val(attachment.id); var instruction=self.closest('.instruction-inside'); var wrap=instruction.siblings('.image-wrap'); wrap.find('img').attr('src', attachment.url); wrap.find('img').removeAttr('srcset'); instruction.addClass('dokan-hide'); wrap.removeClass('dokan-hide'); }); }); product_featured_frame.open(); }}, removeImage: function(e){ e.preventDefault(); var self=$(this); var wrap=self.closest('.image-wrap'); var instruction=wrap.siblings('.instruction-inside'); instruction.find('input.dokan-feat-image-id').val('0'); wrap.addClass('dokan-hide'); instruction.removeClass('dokan-hide'); }}, fileDownloadable: function(e){ e.preventDefault(); var self=$(this), downloadable_frame; if(downloadable_frame){ downloadable_frame.open(); return; } downloadable_frame=wp.media({ title: dokan.i18n_choose_file, button: { text: dokan.i18n_choose_file_btn_text, }, multiple: true }); downloadable_frame.on('select', function(){ var selection=downloadable_frame.state().get('selection'); selection.map(function(attachment){ attachment=attachment.toJSON(); self.closest('tr').find('input.wc_file_url, input.wc_variation_file_url').val(attachment.url); }); }); downloadable_frame.on('ready', function(){ downloadable_frame.uploader.options.uploader.params={ type: 'downloadable_product' };}); downloadable_frame.open(); }}; $(function(){ Dokan_Editor.init(); $('select#product_type').change(function(){ var select_val=$(this).val(); if('variable'===select_val){ $('input#_manage_stock').change(); $('input#_downloadable').prop('checked', false); $('input#_virtual').removeAttr('checked'); } show_and_hide_panels(); $(document.body).trigger('dokan-product-type-change', select_val, $(this)); }).change(); $('.product-edit-container').on('change', 'input#_downloadable, input#_virtual', function(){ show_and_hide_panels(); }).change(); $('input#_downloadable').change(); $('input#_virtual').change(); function show_and_hide_panels(){ var product_type=$('#product_type').val(); var is_virtual=$('input#_virtual:checked').length; var is_downloadable=$('input#_downloadable:checked').length; var hide_classes='.hide_if_downloadable, .hide_if_virtual'; var show_classes='.show_if_downloadable, .show_if_virtual'; $.each(Object.keys(dokan.product_types), function(index, value){ hide_classes=hide_classes + ', .hide_if_' + value; show_classes=show_classes + ', .show_if_' + value; }); $(hide_classes).show(); $(show_classes).hide(); if(is_downloadable){ $('.show_if_downloadable').show(); } if(is_virtual){ $('.show_if_virtual').show(); } $('.show_if_' + product_type).show(); if(is_downloadable){ $('.hide_if_downloadable').hide(); } if(is_virtual){ $('.hide_if_virtual').hide(); } $('.hide_if_' + product_type).hide(); $('input#_manage_stock').change(); } $('.sale_price_dates_fields').each(function(){ var $these_sale_dates=$(this); var sale_schedule_set=false; var $wrap=$these_sale_dates.closest('div, table'); $these_sale_dates.find('input').each(function(){ if(''!==$(this).val()){ sale_schedule_set=true; }}); if(sale_schedule_set){ $wrap.find('.sale_schedule').hide(); $wrap.find('.sale_price_dates_fields').show(); }else{ $wrap.find('.sale_schedule').show(); $wrap.find('.sale_price_dates_fields').hide(); }}); $('.product-edit-container').on('click', '.sale_schedule', function(){ var $wrap=$(this).closest('.product-edit-container, div.dokan-product-variation-itmes, table'); $(this).hide(); $wrap.find('.cancel_sale_schedule').show(); $wrap.find('.sale_price_dates_fields').show(); return false; }); $('.product-edit-container').on('click', '.cancel_sale_schedule', function(){ var $wrap=$('.product-edit-container, div.dokan-product-variation-itmes, table'); $(this).hide(); $wrap.find('.sale_schedule').show(); $wrap.find('.sale_price_dates_fields').hide(); $wrap.find('.sale_price_dates_fields').find('input').val(''); return false; }); function dokan_show_earning_suggestion(callback){ let commission=$('span.vendor-earning').attr('data-commission'); let product_id=$('span.vendor-earning').attr('data-product-id'); let product_price=$('input.dokan-product-regular-price').val(); let sale_price=$('input.dokan-product-sales-price').val(); let earning_suggestion=$('.simple-product span.vendor-price'); earning_suggestion.html('Calculating'); $.get(dokan.ajaxurl, { action: 'get_vendor_earning', product_id: product_id, product_price: product_price, product_price: sale_price ? sale_price:product_price, _wpnonce: dokan.nonce }) .done(( response)=> { earning_suggestion.html(response); if(typeof callback==='function'){ callback(); }}); } $("input.dokan-product-regular-price, input.dokan-product-sales-price").on('keyup', _.debounce(()=> { dokan_show_earning_suggestion(function(){ if($('#product_type').val()=='simple'||$('#product_type').text()==''){ if(Number($('.simple-product span.vendor-price').text()) < 0){ $($('.dokan-product-less-price-alert').removeClass('dokan-hide')); $('input[type=submit]').attr('disabled', 'disabled'); $('button[type=submit]').attr('disabled', 'disabled'); }else{ $($('.dokan-product-less-price-alert').addClass('dokan-hide')); $('input[type=submit]').removeAttr('disabled'); $('button[type=submit]').removeAttr('disabled'); }} }); }, 750)); function debounce_delay(callback, ms){ var timer=0; return function(){ var context=this, args=arguments; clearTimeout(timer); timer=setTimeout(function (){ callback.apply(context, args); }, ms||0); };} $('body').on('keyup', '.dokan-product-sales-price, .dokan-product-regular-price', debounce_delay(function(evt){ evt.preventDefault(); var product_price=$('input.dokan-product-regular-price').val(); var sale_price_wrap=$('input.dokan-product-sales-price'); var sale_price=sale_price_wrap.val(); var sale_price_input_div=sale_price_wrap.parent('div.dokan-input-group'); var sale_price_input_msg="" + dokan.i18n_sales_price_error + ""; var sale_price_parent_div=sale_price_input_div.parent('div.sale-price').find('span.error'); if(''==product_price){ sale_price_parent_div.remove(); sale_price_input_div.after(sale_price_input_msg); sale_price_wrap.val(''); setTimeout(function(){ sale_price_parent_div.remove(); }, 5000); }else if(parseFloat(product_price) <=parseFloat(sale_price)){ sale_price_parent_div.remove(); sale_price_input_div.after(sale_price_input_msg); sale_price_wrap.val(''); setTimeout(function(){ sale_price_parent_div.remove(); }, 5000); }else{ sale_price_parent_div.remove(); }} ,600)); }); })(jQuery); jQuery(function($){ var api=wp.customize; $('.datepicker').datepicker({ dateFormat: 'yy-mm-dd' }); $('.tips').tooltip(); function showTooltip(x, y, contents){ jQuery('
    ' + contents + '
    ').css({ top: y - 16, left: x + 20 }).appendTo("body").fadeIn(200); } var prev_data_index=null; var prev_series_index=null; jQuery(".chart-placeholder").bind("plothover", function(event, pos, item){ if(item){ if(prev_data_index!=item.dataIndex||prev_series_index!=item.seriesIndex){ prev_data_index=item.dataIndex; prev_series_index=item.seriesIndex; jQuery(".chart-tooltip").remove(); if(item.series.points.show||item.series.enable_tooltip){ var y=item.series.data[item.dataIndex][1]; tooltip_content=''; if(item.series.prepend_label) tooltip_content=tooltip_content + item.series.label + ": "; if(item.series.prepend_tooltip) tooltip_content=tooltip_content + item.series.prepend_tooltip; tooltip_content=tooltip_content + y; if(item.series.append_tooltip) tooltip_content=tooltip_content + item.series.append_tooltip; if(item.series.pie.show){ showTooltip(pos.pageX, pos.pageY, tooltip_content); }else{ showTooltip(item.pageX, item.pageY, tooltip_content); }} }}else{ jQuery(".chart-tooltip").remove(); prev_data_index=null; }}); }); (function($){ $.validator.setDefaults({ ignore: ":hidden" }); var validatorError=function(error, element){ var form_group=$(element).closest('.dokan-form-group'); form_group.addClass('has-error').append(error); }; var validatorSuccess=function(label, element){ $(element).closest('.dokan-form-group').removeClass('has-error'); }; var api=wp.customize; var Dokan_Settings={ init: function(){ var self=this; $('a.dokan-banner-drag').on('click', this.imageUpload); $('a.dokan-remove-banner-image').on('click', this.removeBanner); $('a.dokan-pro-gravatar-drag').on('click', this.gragatarImageUpload); $('a.dokan-gravatar-drag').on('click', this.simpleImageUpload); $('a.dokan-remove-gravatar-image').on('click', this.removeGravatar); this.validateForm(self); return false; }, calculateImageSelectOptions: function(attachment, controller){ var xInit=parseInt(dokan.store_banner_dimension.width, 10), yInit=parseInt(dokan.store_banner_dimension.height, 10), flexWidth = !! parseInt(dokan.store_banner_dimension['flex-width'], 10), flexHeight = !! parseInt(dokan.store_banner_dimension['flex-height'], 10), ratio, xImg, yImg, realHeight, realWidth, imgSelectOptions; realWidth=attachment.get('width'); realHeight=attachment.get('height'); this.headerImage=new api.HeaderTool.ImageModel(); this.headerImage.set({ themeWidth: xInit, themeHeight: yInit, themeFlexWidth: flexWidth, themeFlexHeight: flexHeight, imageWidth: realWidth, imageHeight: realHeight }); controller.set('canSkipCrop', ! this.headerImage.shouldBeCropped()); ratio=xInit / yInit; xImg=realWidth; yImg=realHeight; if(xImg / yImg > ratio){ yInit=yImg; xInit=yInit * ratio; }else{ xInit=xImg; yInit=xInit / ratio; } imgSelectOptions={ handles: true, keys: true, instance: true, persistent: true, imageWidth: realWidth, imageHeight: realHeight, x1: 0, y1: 0, x2: xInit, y2: yInit }; if(flexHeight===false&&flexWidth===false){ imgSelectOptions.aspectRatio=xInit + ':' + yInit; } if(flexHeight===false){ imgSelectOptions.maxHeight=yInit; } if(flexWidth===false){ imgSelectOptions.maxWidth=xInit; } return imgSelectOptions; }, onSelect: function(){ this.frame.setState('cropper'); }, onCropped: function(croppedImage){ var url=croppedImage.url, attachmentId=croppedImage.attachment_id, w=croppedImage.width, h=croppedImage.height; this.setImageFromURL(url, attachmentId, w, h); }, onSkippedCrop: function(selection){ var url=selection.get('url'), w=selection.get('width'), h=selection.get('height'); this.setImageFromURL(url, selection.id, w, h); }, setImageFromURL: function(url, attachmentId, width, height){ if($(this.uploadBtn).hasClass('dokan-banner-drag')){ var wrap=$(this.uploadBtn).closest('.dokan-banner'); wrap.find('input.dokan-file-field').val(attachmentId); wrap.find('img.dokan-banner-img').attr('src', url); $(this.uploadBtn).parent().siblings('.image-wrap', wrap).removeClass('dokan-hide'); $(this.uploadBtn).parent('.button-area').addClass('dokan-hide'); }else if($(this.uploadBtn).hasClass('dokan-pro-gravatar-drag')){ var wrap=$(this.uploadBtn).closest('.dokan-gravatar'); wrap.find('input.dokan-file-field').val(attachmentId); wrap.find('img.dokan-gravatar-img').attr('src', url); $(this.uploadBtn).parent().siblings('.gravatar-wrap', wrap).removeClass('dokan-hide'); $(this.uploadBtn).parent('.gravatar-button-area').addClass('dokan-hide'); }}, removeImage: function(){ api.HeaderTool.currentHeader.trigger('hide'); api.HeaderTool.CombinedList.trigger('control:removeImage'); }, imageUpload: function(e){ e.preventDefault(); var file_frame, settings=Dokan_Settings; settings.uploadBtn=this; settings.frame=wp.media({ multiple: false, button: { text: dokan.selectAndCrop, close: false }, states: [ new wp.media.controller.Library({ title: dokan.chooseImage, library: wp.media.query({ type: 'image' }), multiple: false, date: false, priority: 20, suggestedWidth: dokan.store_banner_dimension.width, suggestedHeight: dokan.store_banner_dimension.height }), new wp.media.controller.Cropper({ suggestedWidth: 5000, imgSelectOptions: settings.calculateImageSelectOptions }) ] }); settings.frame.on('select', settings.onSelect, settings); settings.frame.on('cropped', settings.onCropped, settings); settings.frame.on('skippedcrop', settings.onSkippedCrop, settings); settings.frame.open(); }, calculateImageSelectOptionsProfile: function(attachment, controller){ var xInit=150, yInit=150, flexWidth = !! parseInt(dokan.store_banner_dimension['flex-width'], 10), flexHeight = !! parseInt(dokan.store_banner_dimension['flex-height'], 10), ratio, xImg, yImg, realHeight, realWidth, imgSelectOptions; realWidth=attachment.get('width'); realHeight=attachment.get('height'); this.headerImage=new api.HeaderTool.ImageModel(); this.headerImage.set({ themeWidth: xInit, themeHeight: yInit, themeFlexWidth: flexWidth, themeFlexHeight: flexHeight, imageWidth: realWidth, imageHeight: realHeight }); controller.set('canSkipCrop', ! this.headerImage.shouldBeCropped()); ratio=xInit / yInit; xImg=realWidth; yImg=realHeight; if(xImg / yImg > ratio){ yInit=yImg; xInit=yInit * ratio; }else{ xInit=xImg; yInit=xInit / ratio; } imgSelectOptions={ handles: true, keys: true, instance: true, persistent: true, imageWidth: realWidth, imageHeight: realHeight, x1: 0, y1: 0, x2: xInit, y2: yInit }; if(flexHeight===false&&flexWidth===false){ imgSelectOptions.aspectRatio=xInit + ':' + yInit; } if(flexHeight===false){ imgSelectOptions.maxHeight=yInit; } if(flexWidth===false){ imgSelectOptions.maxWidth=xInit; } return imgSelectOptions; }, simpleImageUpload:function(e){ e.preventDefault(); var file_frame, self=$(this); if(file_frame){ file_frame.open(); return; } file_frame=wp.media.frames.file_frame=wp.media({ title: jQuery(this).data('uploader_title'), button: { text: jQuery(this).data('uploader_button_text') }, multiple: false }); file_frame.on('select', function(){ var attachment=file_frame.state().get('selection').first().toJSON(); var wrap=self.closest('.dokan-gravatar'); wrap.find('input.dokan-file-field').val(attachment.id); wrap.find('img.dokan-gravatar-img').attr('src', attachment.url); self.parent().siblings('.gravatar-wrap', wrap).removeClass('dokan-hide'); self.parent('.gravatar-button-area').addClass('dokan-hide'); }); file_frame.open(); }, gragatarImageUpload: function(e){ e.preventDefault(); var file_frame, settings=Dokan_Settings; settings.uploadBtn=this; settings.frame=wp.media({ multiple: false, button: { text: dokan.selectAndCrop, close: false }, states: [ new wp.media.controller.Library({ title: dokan.chooseImage, library: wp.media.query({ type: 'image' }), multiple: false, date: false, priority: 20, suggestedWidth: 150, suggestedHeight: 150 }), new wp.media.controller.Cropper({ imgSelectOptions: settings.calculateImageSelectOptionsProfile }) ] }); settings.frame.on('select', settings.onSelect, settings); settings.frame.on('cropped', settings.onCropped, settings); settings.frame.on('skippedcrop', settings.onSkippedCrop, settings); settings.frame.open(); }, submitSettings: function(form_id){ if(typeof tinyMCE!='undefined'){ tinyMCE.triggerSave(); } var self=$("form#" + form_id), form_data=self.serialize() + '&action=dokan_settings&form_id=' + form_id; self.find('.ajax_prev').append(' '); $.post(dokan.ajaxurl, form_data, function(resp){ self.find('span.dokan-loading').remove(); $('html,body').animate({scrollTop:100}); if(resp.success){ $('.dokan-ajax-response').html($('
    ', { 'class': 'dokan-alert dokan-alert-success', 'html': '

    ' + resp.data.msg + '

    ', })); $('.dokan-ajax-response').append(resp.data.progress); }else{ $('.dokan-ajax-response').html($('
    ', { 'class': 'dokan-alert dokan-alert-danger', 'html': '

    ' + resp.data + '

    ' })); }}); }, validateForm: function(self){ $("form#settings-form, form#profile-form, form#store-form, form#payment-form").validate({ submitHandler: function(form){ self.submitSettings(form.getAttribute('id')); }, errorElement: 'span', errorClass: 'error', errorPlacement: validatorError, success: validatorSuccess, ignore: '.select2-search__field, :hidden, .mapboxgl-ctrl-geocoder--input' }); }, removeBanner: function(e){ e.preventDefault(); var self=$(this); var wrap=self.closest('.image-wrap'); var instruction=wrap.siblings('.button-area'); wrap.find('input.dokan-file-field').val('0'); wrap.addClass('dokan-hide'); instruction.removeClass('dokan-hide'); }, removeGravatar: function(e){ e.preventDefault(); var self=$(this); var wrap=self.closest('.gravatar-wrap'); var instruction=wrap.siblings('.gravatar-button-area'); wrap.find('input.dokan-file-field').val('0'); wrap.addClass('dokan-hide'); instruction.removeClass('dokan-hide'); }, }; var Dokan_Withdraw={ init: function(){ var self=this; this.withdrawValidate(self); }, withdrawValidate: function(self){ $('form.withdraw').validate({ errorElement: 'span', errorClass: 'error', errorPlacement: validatorError, success: validatorSuccess }) }}; var Dokan_Seller={ init: function(){ this.validate(this); }, validate: function(self){ $('form#dokan-form-contact-seller').validate({ errorPlacement: validatorError, success: validatorSuccess, submitHandler: function(form){ $(form).block({ message: null, overlayCSS: { background: '#fff url(' + dokan.ajax_loader + ') no-repeat center', opacity: 0.6 }}); var form_data=$(form).serialize(); $.post(dokan.ajaxurl, form_data, function(resp){ $(form).unblock(); if(typeof resp.data!=='undefined'){ $(form).find('.ajax-response').html(resp.data); } $(form).find('input[type=text], input[type=email], textarea').val('').removeClass('valid'); }); }}); }}; $(function(){ Dokan_Settings.init(); Dokan_Withdraw.init(); Dokan_Seller.init(); $('.dokan-form-horizontal').on('change', 'input[type=checkbox]#lbl_setting_minimum_quantity', function(){ var showSWDiscount=$('.show_if_needs_sw_discount'); if($(this).is(':checked')){ showSWDiscount.find('input[type="number"]').val(''); showSWDiscount.slideDown('slow'); }else{ showSWDiscount.slideUp('slow'); }}); }); })(jQuery); (function($){ var dokan_messages=DokanValidateMsg; dokan_messages.maxlength=$.validator.format(dokan_messages.maxlength_msg); dokan_messages.minlength=$.validator.format(dokan_messages.minlength_msg); dokan_messages.rangelength=$.validator.format(dokan_messages.rangelength_msg); dokan_messages.range=$.validator.format(dokan_messages.range_msg); dokan_messages.max=$.validator.format(dokan_messages.max_msg); dokan_messages.min=$.validator.format(dokan_messages.min_msg); $.validator.messages=dokan_messages; $(document).on('click','#dokan_store_tnc_enable',function(e){ if($(this).is(':checked')){ $('#dokan_tnc_text').show(); }else{ $('#dokan_tnc_text').hide(); }}).ready(function(e){ if($('#dokan_store_tnc_enable').is(':checked')){ $('#dokan_tnc_text').show(); }else{ $('#dokan_tnc_text').hide(); }}); })(jQuery); ;(function($){ function resize_dummy_image(){ var width=dokan.store_banner_dimension.width, height=(dokan.store_banner_dimension.height / dokan.store_banner_dimension.width) * $('#dokan-content').width(); $('.profile-info-img.dummy-image').css({ height: height }); } resize_dummy_image(); $(window).on('resize', function (e){ resize_dummy_image(); }); $(':input.dokan-product-search').filter(':not(.enhanced)').each(function(){ var select2_args={ allowClear: $(this).data('allow_clear') ? true:false, placeholder: $(this).data('placeholder'), minimumInputLength: $(this).data('minimum_input_length') ? $(this).data('minimum_input_length'):'3', escapeMarkup: function(m){ return m; }, language: { errorLoading: function(){ return dokan.i18n_searching; }, inputTooLong: function(args){ var overChars=args.input.length - args.maximum; if(1===overChars){ return dokan.i18n_input_too_long_1; } return dokan.i18n_input_too_long_n.replace('%qty%', overChars); }, inputTooShort: function(args){ var remainingChars=args.minimum - args.input.length; if(1===remainingChars){ return dokan.i18n_input_too_short_1; } return dokan.i18n_input_too_short_n.replace('%qty%', remainingChars); }, loadingMore: function(){ return dokan.i18n_load_more; }, maximumSelected: function(args){ if(args.maximum===1){ return dokan.i18n_selection_too_long_1; } return dokan.i18n_selection_too_long_n.replace('%qty%', args.maximum); }, noResults: function(){ return dokan.i18n_no_matches; }, searching: function(){ return dokan.i18n_searching; }}, ajax: { url: dokan.ajaxurl, dataType: 'json', delay: 250, data: function(params){ return { term: params.term, action: $(this).data('action')||'dokan_json_search_products_and_variations', security: dokan.search_products_nonce, exclude: $(this).data('exclude'), user_ids: $(this).data('user_ids'), include: $(this).data('include'), limit: $(this).data('limit') };}, processResults: function(data){ var terms=[]; if(data){ $.each(data, function(id, text){ terms.push({ id: id, text: text }); }); } return { results: terms };}, cache: true }}; $(this).select2(select2_args).addClass('enhanced'); if($(this).data('sortable')){ var $select=$(this); var $list=$(this).next('.select2-container').find('ul.select2-selection__rendered'); $list.sortable({ placeholder:'ui-state-highlight select2-selection__choice', forcePlaceholderSize: true, items:'li:not(.select2-search__field)', tolerance:'pointer', stop: function(){ $($list.find('.select2-selection__choice').get().reverse()).each(function(){ var id=$(this).data('data').id; var option=$select.find('option[value="' + id + '"]')[0]; $select.prepend(option); }); }}); }}); var bulkItemsSelection={ init: function(){ selected_items=[]; $('#cb-select-all').on('change', function(e){ var self=$(this); var item_id=$('.cb-select-items'); if(self.is(':checked')){ item_id.each(function(key, value){ var item=$(value); item.prop('checked', 'checked'); }); }else{ item_id.each(function(key, value){ $(value).prop('checked', ''); selected_items.pop(); }); }}); }}; bulkItemsSelection.init(); $('.product-cat-stack-dokan li.has-children').on('click', '> a span.caret-icon', function(e){ e.preventDefault(); var self=$(this), liHasChildren=self.closest('li.has-children'); if(!liHasChildren.find('> ul.children').is(':visible')){ self.find('i.fa').addClass('fa-rotate-90'); if(liHasChildren.find('> ul.children').hasClass('level-0')){ self.closest('a').css({ 'borderBottom': 'none' }); }} liHasChildren.find('> ul.children').slideToggle('fast', function (){ if(!$(this).is(':visible')){ self.find('i.fa').removeClass('fa-rotate-90'); if(liHasChildren.find('> ul.children').hasClass('level-0')){ self.closest('a').css({ 'borderBottom': '1px solid #eee' }); }} }); }); $('.store-cat-stack-dokan li.has-children').on('click', '> a span.caret-icon', function(e){ e.preventDefault(); var self=$(this), liHasChildren=self.closest('li.has-children'); if(!liHasChildren.find('> ul.children').is(':visible')){ self.find('i.fa').addClass('fa-rotate-90'); if(liHasChildren.find('> ul.children').hasClass('level-0')){ self.closest('a').css({ 'borderBottom': 'none' }); }} liHasChildren.find('> ul.children').slideToggle('fast', function (){ if(!$(this).is(':visible')){ self.find('i.fa').removeClass('fa-rotate-90'); if(liHasChildren.find('> ul.children').hasClass('level-0')){ self.closest('a').css({ 'borderBottom': '1px solid #eee' }); }} }); }); $(document).ready(function(){ var selectedLi=$('#cat-drop-stack ul').find('a.selected'); selectedLi.css({ fontWeight: 'bold' }); selectedLi.parents('ul.children').each(function(i, val){ $(val).css({ display: 'block' }); }); }); })(jQuery); ;(function($){ var storeLists={ query: {}, form: null, cateItemStringArray: [], init: function(){ $('#dokan-store-listing-filter-wrap .sort-by #stores_orderby').on('change', this.buildSortByQuery); $('#dokan-store-listing-filter-wrap .toggle-view span').on('click', this.toggleView); $('#dokan-store-listing-filter-wrap .dokan-store-list-filter-button, #dokan-store-listing-filter-wrap .dokan-icons, #dokan-store-listing-filter-form-wrap .apply-filter #cancel-filter-btn ').on('click', this.toggleForm); $('#dokan-store-listing-filter-form-wrap .store-search-input').on('change', this.buildSearchQuery); $('#dokan-store-listing-filter-form-wrap .apply-filter #apply-filter-btn').on('click', this.submitForm); this.maybeHideListView(); const self=storeLists; self.form=document.forms.dokan_store_lists_filter_form; const view=self.getLocal('dokan-layout'); if(view){ const toggleBtns=$('.toggle-view span'); self.setView(view, toggleBtns); } const params=self.getParams(); if(params.length){ let openTheForm=false; params.forEach(function(param){ const keys=Object.keys(param); const values=Object.values(param); if(! keys.includes('stores_orderby')||params.length > 1){ openTheForm=true; } self.setParams(keys, values); }); if(openTheForm){ $('#dokan-store-listing-filter-form-wrap').slideToggle(); }} }, buildSortByQuery: function(event){ const self=storeLists; self.query.stores_orderby=event.target.value; self.submitForm(event); }, toggleView: function(event){ const self=storeLists; const currentElement=$(event.target); const elements=currentElement.parent().find('span'); const view=currentElement.data('view'); self.setView(view, elements); self.setLocal('dokan-layout', view); }, setView: function(view, elements){ if(typeof view==='undefined' || view.length < 1 || typeof elements==='undefined' || elements.length < 1 ){ return; } const listingWrap=$('#dokan-seller-listing-wrap'); [...elements].forEach(function(value){ const element=$(value); if(view===element.data('view')){ element.addClass('active'); listingWrap.addClass(view); }else{ element.removeClass('active'); listingWrap.removeClass(element.data('view')); }}); }, toggleForm: function(event){ event.preventDefault(); $('#dokan-store-listing-filter-form-wrap').slideToggle(); }, buildSearchQuery: function(event){ if(event.target.value){ storeLists.query.dokan_seller_search=event.target.value; }else{ delete storeLists.query.dokan_seller_search; }}, submitForm: function(event){ event.preventDefault(); const queryString=decodeURIComponent($.param(storeLists.query)); window.history.pushState(null, null, `?${queryString}`); window.location.reload(); }, setLocal: function(key, value){ window.localStorage.setItem(key, value); }, getLocal: function(key){ return window.localStorage.getItem(key); }, setParams: function(key, value){ const self=storeLists; const elements=self.form ? self.form.elements:''; const sortingForm=document.forms.stores_sorting; const sortingFormElements=sortingForm ? sortingForm.elements:''; Object.values(sortingFormElements).forEach(function(element){ if(element.name===key[0]){ $(element).val(value[0]); }}); Object.values(elements).forEach(function(element){ if(key.includes(element.name)){ if(element.type==='checkbox'){ element.checked=['yes', 'true', '1'].includes(value[0]) ? true:false; }else if([ 'text', 'search' ].includes(element.type)){ element.value=value[0]; }} if(key[0].includes('store_categories[')||key[0].includes('store_category[')){ const trimedValue=value[0].split(' ').join('-'); const cateItem=$(`[data-slug=${trimedValue}]`); if(! self.cateItemStringArray.includes(cateItem.text().trim())){ self.cateItemStringArray.push(cateItem.text().trim()); } cateItem.addClass('dokan-btn-theme'); }else if(key[0]==='rating'){ const trimedValue=value[0].split(' ').join('-'); $(`[data-${key[0]}=${trimedValue}]`).addClass('active'); $(`[data-rating=${trimedValue}]`).parent().addClass('selected'); }}); key.forEach(function(param, index){ if(! param.includes('[')){ self.query[ param ]=value[ index ]; }}); }, getParams: function(){ const params=new URLSearchParams(location.search); const allParams=[]; params.forEach(function(value, key){ allParams.push({ [key]: value }); }); return allParams; }, maybeHideListView: function(){ const self=storeLists; if(window.matchMedia('(max-width: 767px)').matches){ if('list-view'===self.getLocal('dokan-layout')){ self.setLocal('dokan-layout', 'grid-view'); }} $(window).on('resize', function(){ const container=$(this); if(container.width() < 767){ $('#dokan-seller-listing-wrap').removeClass('list-view'); $('#dokan-seller-listing-wrap').addClass('grid-view'); }else{ $('.toggle-view.item span').last().removeClass('active'); $('.toggle-view.item span').first().addClass('active'); }}); }}; if(window.dokan){ window.dokan.storeLists=storeLists; window.dokan.storeLists.init(); }})(jQuery); !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;hc;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('
      ');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('
    • '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(''),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('
        '),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('
      • ×
      • ');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('×');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change"); if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
      • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null; },e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&(f=d(this),null!=f&&g.push(f))})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;return this._isInitialized?void b.call(this,c):void this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `